Skip to content

Opencode stuck in "generating" #2512

Closed
Closed

Description

@goszczynskip

When submitting a prompt, opencode doesn't return any response and is unresponsive to double-esc key press (interrupt). It shows "generating". Stopping process with double Ctrl-C exits tui but doesn't return to terminal. Hitting Ctrl-C the third time exits back to the terminal.

I've tried to change the model or prompt. Still, it produces the same

- kitty 0.37.0
- opencode 0.6.8
- model (tested on Anthropic Sonnet 4 and GPT OSS 120B (groq)).

Activity

  1. github-actions commented on Sep 9, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. goszczynskip commented on Sep 9, 2025

    @goszczynskip
    Author

    Running without tui is also hanging

     redacted-user@redacted-host  ~/redacted   main ±  opencode run "Hello" --print-logs --model="anthropic/claude-sonnet-4-20250514"
    INFO  2025-09-09T09:06:20 +52ms service=default version=0.6.8 args=["run","Hello","--print-logs","--model=anthropic/claude-sonnet-4-20250514"] opencode
    INFO  2025-09-09T09:06:20 +0ms service=project directory=/Users/redacted-user/redacted-path fromDirectory
    INFO  2025-09-09T09:06:20 +24ms service=config path=/Users/redacted-user/.config/opencode/config.json loading
    INFO  2025-09-09T09:06:20 +0ms service=config path=/Users/redacted-user/.config/opencode/opencode.json loading
    INFO  2025-09-09T09:06:20 +2ms service=config path=/Users/redacted-user/.config/opencode/opencode.jsonc loading
    INFO  2025-09-09T09:06:20 +1ms service=plugin path=opencode-copilot-auth@0.0.2 loading plugin
    INFO  2025-09-09T09:06:20 +1ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
    INFO  2025-09-09T09:06:20 +10ms service=bus type=* subscribing
    INFO  2025-09-09T09:06:20 +0ms service=bus type=session.updated subscribing
    INFO  2025-09-09T09:06:20 +0ms service=bus type=message.updated subscribing
    INFO  2025-09-09T09:06:20 +0ms service=bus type=message.part.updated subscribing
    INFO  2025-09-09T09:06:20 +0ms service=format init
    INFO  2025-09-09T09:06:20 +1ms service=bus type=file.edited subscribing
    INFO  2025-09-09T09:06:20 +0ms service=session id=ses_6d2461e5fffep9BBGQA63SmHWV version=0.6.8 projectID=eab9d385a6d2211e0051f4dea79ee790bd1e6df1 directory=/Users/redacted-user/redacted-path title=New session - 2025-09-09T09:06:20.704Z time={"created":1757408780704,"updated":1757408780704} created
    INFO  2025-09-09T09:06:20 +0ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd enabled LSP servers
    INFO  2025-09-09T09:06:20 +1ms service=bus type=session.updated publishing
    INFO  2025-09-09T09:06:20 +1ms service=bus type=message.part.updated subscribing
    INFO  2025-09-09T09:06:20 +0ms service=bus type=session.error subscribing
    INFO  2025-09-09T09:06:20 +1ms service=session session=ses_6d2461e5fffep9BBGQA63SmHWV chatting
    INFO  2025-09-09T09:06:20 +2ms service=bus type=message.updated publishing
    INFO  2025-09-09T09:06:20 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-09T09:06:20 +1ms service=bus type=session.updated publishing
    INFO  2025-09-09T09:06:20 +2ms service=models.dev file={} refreshing
    INFO  2025-09-09T09:06:20 +1ms service=provider init
    INFO  2025-09-09T09:06:20 +0ms service=provider providerID=openrouter found
    INFO  2025-09-09T09:06:20 +1ms service=provider providerID=anthropic found
    INFO  2025-09-09T09:06:20 +0ms service=provider providerID=groq found
    INFO  2025-09-09T09:06:20 +0ms service=provider providerID=opencode found
    INFO  2025-09-09T09:06:20 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 getModel
    INFO  2025-09-09T09:06:20 +0ms service=provider status=started providerID=anthropic getSDK
    INFO  2025-09-09T09:06:20 +55ms service=provider status=completed duration=55 providerID=anthropic getSDK
    INFO  2025-09-09T09:06:20 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 found
    INFO  2025-09-09T09:06:20 +2ms service=session session=ses_6d2461e5fffep9BBGQA63SmHWV sessionID=ses_6d2461e5fffep9BBGQA63SmHWV locking
    INFO  2025-09-09T09:06:20 +1ms service=provider providerID=anthropic modelID=claude-3-5-haiku-20241022 getModel
    INFO  2025-09-09T09:06:20 +0ms service=provider status=started providerID=anthropic getSDK
    INFO  2025-09-09T09:06:20 +0ms service=provider status=completed duration=0 providerID=anthropic getSDK
    INFO  2025-09-09T09:06:20 +0ms service=provider providerID=anthropic modelID=claude-3-5-haiku-20241022 found
    INFO  2025-09-09T09:06:20 +22ms service=bus type=message.updated publishing
    INFO  2025-09-09T09:06:20 +1ms service=mcp key=figma type=remote found
    INFO  2025-09-09T09:06:21 +1001ms service=bus type=session.updated publishing
    
    [stuck here]
    
  3. goszczynskip commented on Sep 9, 2025

    @goszczynskip
    Author

    I've tried to delete ~/.cache/opencode, but it didn't resolve the issue. It's still stuck on session.update publishing

  4. BrianLeishman commented on Sep 9, 2025

    @BrianLeishman

    Claude Code also gets stuck like this sometimes, sending just a . can kick it and make it carry on

  5. rekram1-node commented on Sep 9, 2025

    @rekram1-node
    Collaborator

    Does this hang happen regardless of directory?

  6. goszczynskip commented on Sep 9, 2025

    @goszczynskip
    Author

    Yes, I've just tested it in a different directory — same behavior.

  7. colout commented on Sep 9, 2025

    @colout

    not sure if it helps, but I ran into this with groq through my litellm proxy. Because it's through litellm, i saw this error in the logs section of the litellm ui:

    litellm.RateLimitError: RateLimitError: GroqException - {"error":{"message":"Request too large for model `moonshotai/kimi-k2-instruct-0905` in organization `xxxxxxxxxxxx` service tier `on_demand` on tokens per minute (TPM): Limit 10000, Requested 12874, please reduce your message size and try again. Need more tokens? Upgrade to Dev Tier today at https://console.groq.com/settings/billing","type":"tokens","code":"rate_limit_exceeded"}}
    

    ...it turns out my credit card expired so they downgraded me to free tier (with the silly low limit). Since you're also on Groq, check your limits...that might be it

  8. Red4Hack commented on Sep 9, 2025

    @Red4Hack

    I'm having the same problem. I installed opencode today after an AI_APICallError: The messages parameter is illegal. Please check the documentation. I told it to continue, it read the file and responded but stopped after that it didn't work anymore even though I told it to continue, after I told it to continue several times it gave an error of

    DEBUG 2025-09-09T21:19:50 +1ms service=tui timeTakenMs=30 messages. renderView
    ERROR 2025-09-09T21:19:50 +24ms service=session session=ses_6cfa6a9a3ffee6MUfm4v6n9461 error=Expected 'id' to be a string.
    INFO 2025-09-09T21:19:50 +1ms service=bus type=session.error publishing
    INFO 2025-09-09T21:19:50 +3ms service=bus type=message. updated publishing
    INFO 2025-09-09T21:19:50 +0ms service=session session=ses_6cfa6a9a3ffee6MUfm4v6n9461 sessionID=ses_6cfa6a9a3ffee6MUfm4v6n9461 unlocking
    INFO 2025-09-09T21:19:50 +1ms service=bus type=session. idle publishing
    INFO 2025-09-09T21:19:50 +0ms service=server duration=4923 response
    INFO 2025-09-09T21:19:50 +1ms service=project directory=/home/hack/Dev/fastdl-source fromDirectory
    ERROR 2025-09-09T21:19:50 +0ms service=tui message=AI_InvalidResponseDataError: Expected 'id' to be a string. name=UnknownError Server error
    

    after that it worked again

    Provider: z.ai Model: GLM-4.5-Flash

    after update 0.6.9 it worked again for a while and stuck again

  9. goszczynskip commented on Sep 10, 2025

    @goszczynskip
    Author

    I was playing around and resolved this by downgrading versions sequentially to 0.6.5. After running again, I got it working. Now it started working after upgrading back to 0.6.10. I'm not sure if downgrades fixed anything, or if the application was in a bad state and some LLM response got it unstuck.

    Although the issue of ignored interrupt signals (esc+esc) during the session.updated publishing event is still present in the code, so I'm leaving this issue open.

  10. NaikSoftware commented on Sep 10, 2025

    @NaikSoftware

    Sometimes the same problem

  11. maciejk-code commented on Sep 11, 2025

    @maciejk-code

    Yeah happens for me too. Unfortunately too often

  12. mauriciojuniorsympla commented on Sep 11, 2025

    @mauriciojuniorsympla

    after 3 or 4 prompts, it just get stuck

  13. rekram1-node commented on Sep 11, 2025

    @rekram1-node
    Collaborator

    This seems related to mcp servers, @goszczynskip can you disable the figma mcp and try again?

    The remote mcps seem to be hanging

    same goes for others in this thread, try disabling your remote mcp

  14. NaikSoftware commented on Sep 15, 2025

    @NaikSoftware

    Stuck again on the latest 0.9.0. After completing a plan in planning mode. All results are successfully rendered, but I see the message "Generating..."

    Image
  15. 29 remaining items

  16. NaikSoftware commented on Oct 7, 2025

    @NaikSoftware

    @rekram1-node after I sent /new command a new conversation was created and I continued my work

  17. simonlearnscoding commented on Oct 30, 2025

    @simonlearnscoding

    having the same issue here on v0.15.2

  18. rekram1-node commented on Oct 31, 2025

    @rekram1-node
    Collaborator

    @simonlearnscoding consider updating to latest, but can u show me the output:

    opencode run hello --print-logs

  19. darrenangle commented on Dec 18, 2025

    @darrenangle

    I just did a fresh install of OpenCode, and used my anthropic claude max auth, and it's freezing on every single turn. seems like it's particular with streaming, as eventually it unfreezes and all of the messages come through at once. before that, I can't issue any commands, start typing the next prompt, scroll up, or anything. just have to wait until the entire completion is done then suddenly the ui catches up.

    edit-- this seems to be related to a particular session. when i start a new session I don't see this, but for this one i do, whether in terminal or ghostty. this particular session does have a 40MB sql file in it, but traversing large text files / logs is kinda table stakes for cli agents imo

  20. rekram1-node commented on Dec 18, 2025

    @rekram1-node
    Collaborator

    @darrenangle any way u could share rhis session?

    opencode export > session.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions