Skip to content

OpenCode immediately enters auto-compaction loop and stops generating responses #30680

Closed as not planned

Description

@VineshF1

Description

OpenCode is repeatedly auto-compacting and consuming tokens in a loop, even when started in a completely new empty folder.

In addition to the excessive compaction, the model eventually stops generating responses altogether. Instead of answering prompts, OpenCode repeatedly compacts the conversation and becomes unusable.

-Tested in a brand-new empty folder.
-No project files were loaded.
-Reinstalling OpenCode did not fix the issue.
-The problem persists across new sessions.
-The issue appears unrelated to repository size because it occurs before any meaningful context is added.
-Eventually, OpenCode stops responding to prompts and only continues compacting.

This results in unnecessary token consumption and prevents normal usage of OpenCode. I have installed opencode desktop version too and the same issue continues there as well.

Environment using:
OpenCode version: 1.15.13
Operating System: Windows (replace with exact version)
Provider: OpenCode Zen
Fresh install: Yes

Activity

  1. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Steps to reproduce is empty — please describe how to trigger the compaction loop (e.g., what command you ran, what model/provider you're using, what you observe step by step)
    • OpenCode version is empty — please include your exact version (run opencode --version)
    • Operating System and Terminal are empty — please fill these in so we can narrow down whether this is environment-specific

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If your issue matches one of these, consider adding a comment there instead.

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now has the necessary information and follows the bug report template. We'll take a look at the auto-compaction loop issue.

  3. ozcajefff commented on Jun 4, 2026

    @ozcajefff

    I have the same problem

  4. inversed-ru commented on Jun 4, 2026

    @inversed-ru

    Same. Subagents autocompact well below actual context limit, then the model just stops generating at 65535 total tokens.
    OpenCode version: 1.15.13
    Operating System: LMDE 6 (faye) x86_64
    Provider: Llama.cpp

  5. VineshF1 commented on Jun 5, 2026

    @VineshF1
    Author

    I tried using OpenRouter free model to check whether it was woking fine. But I encountered an error of rate limiting. So I checked the usage in the OpenRouter website, I was shocked that the model consumed 191K tokens in a span of 2 minutes. So the main problem is the OpenCode itself. Who was seeing this message kindly make an issue, so that it will reach the developers asap.

  6. DenisSilent commented on Jun 6, 2026

    @DenisSilent

    Happening for me with multiple different providers, including free OpenCode Zen models. Sadly, this makes OpenCode unusable, and it indeed is a problem on OpenCode's side.
    1.16.2; both with some and with no plugins; installed using npm.

    Deleting/moving away skills fixed this problem, it might as well for you.

  7. VineshF1 commented on Jun 7, 2026

    @VineshF1
    Author

    The problem still persists.

  8. harshsinghmp commented on Jun 28, 2026

    @harshsinghmp

    I can still see the issue.

    Here is my output after 3 loop

    - Awaiting user task specification
    Constraints & Preferences
    - (none)
    Progress
    Done
    - (none)
    In Progress
    - (none)
    Blocked
    - (none)
    Key Decisions
    - (none)
    Next Steps
    - Wait for user response with a specific task or project
    Critical Context
    - Awaiting user input — assistant asked "What would you like to work on?"
    Relevant Files
    - (none)
    ▣  Compaction · Big Pickle · 8.8s```
    
  9. VineshF1 commented on Jun 29, 2026

    @VineshF1
    Author

    The issue still persists? It's been over a month. I was tired of opencode, and jumped to use another cli

  10. exanova-y commented on Jun 29, 2026

    @exanova-y

    I have this problem too

  11. tuxick commented on Jul 1, 2026

    @tuxick

    The issue still persists? It's been over a month. I was tired of opencode, and jumped to use another cli

    Still happening here

  12. apaul314 commented on Jul 4, 2026

    @apaul314

    facing the same

  13. harshsinghmp commented on Jul 21, 2026

    @harshsinghmp

    Installed in a new system and got the same output again. While researching I pinpointed that some models are causing the issues, so check what other models you can use without the loop.

    According to Gemini:

    The continuous loop and context loss you are experiencing with the opencode/big-pickle model stems from a critical upstream routing bug coupled with state-handling errors in OpenCode's engine.The Big Pickle stealth model (which routes through the OpenCode Zen endpoint) frequently trips over tool completion detection. When a tool call finishes, OpenCode fails to properly intercept the API provider's finish_reason: "stop". It mistakenly interprets the response as incomplete, continuously sending an empty buffer or a synthetic request back to the provider. This creates an infinite loop that completely wipes the sliding window context mid-session, blowing past your rate limits and quota.

  14. VineshF1 commented on Jul 21, 2026

    @VineshF1
    Author

    Ths main problem was in the CLI itself. Sad to see the issue still persists and didn't get fixed. It's been a long time i mentioned this issue.

  15. CoderTom314 commented on Jul 29, 2026

    @CoderTom314

    facing the same issue with latest release

  16. CyberTodBG commented on Aug 24, 2026

    @CyberTodBG

    Just happened to me today. And cannot pinpoint the cause for this.

  17. vagneradriel commented on Sep 5, 2026

    @vagneradriel

    Just happened to me today. Could the fact that the Open Code Go subscription is reaching its monthly limit be related?

  18. soynikmec-sys commented on Sep 19, 2026

    @soynikmec-sys

    It just happened to me today; it happens with all the models provided by OpenCode, but if I connect one of the free models from NVIDIA, it works correctly.

    Update: The issue was that I had many plugins and MCPs installed, which consumed a large amount of context space just by starting a conversation. One of them, the Vercel MCP, for some reason was the heaviest and most problematic. I uninstalled it, and now I have enough context space to use OpenCode normally. This solution might be helpful for some of you.

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