You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenCode immediately enters auto-compaction loop and stops generating responses #30680
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
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:
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.
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
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.
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.
- 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```
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.
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.
Activity
github-actions commentedon Jun 4, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
opencode --version)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.
github-actions commentedon Jun 4, 2026
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.
ozcajefff commentedon Jun 4, 2026
I have the same problem
inversed-ru commentedon Jun 4, 2026
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
VineshF1 commentedon Jun 5, 2026
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.
DenisSilent commentedon Jun 6, 2026
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.
VineshF1 commentedon Jun 7, 2026
The problem still persists.
harshsinghmp commentedon Jun 28, 2026
I can still see the issue.
Here is my output after 3 loop
VineshF1 commentedon Jun 29, 2026
The issue still persists? It's been over a month. I was tired of opencode, and jumped to use another cli
exanova-y commentedon Jun 29, 2026
I have this problem too
tuxick commentedon Jul 1, 2026
Still happening here
apaul314 commentedon Jul 4, 2026
facing the same
harshsinghmp commentedon Jul 21, 2026
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.
VineshF1 commentedon Jul 21, 2026
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.
CoderTom314 commentedon Jul 29, 2026
facing the same issue with latest release
CyberTodBG commentedon Aug 24, 2026
Just happened to me today. And cannot pinpoint the cause for this.
vagneradriel commentedon Sep 5, 2026
Just happened to me today. Could the fact that the Open Code Go subscription is reaching its monthly limit be related?
soynikmec-sys commentedon Sep 19, 2026
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.