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
I have noticed when using opencode recently with Opus 4.5 (unsure if its the model's fault), compaction fails to run on time and the context balloons too big before compaction can reduce it. See the image
If I try to run /compact after this, the same error repeats. If I write a text prompt, it also fails with the same errors. This forces me to start a new session.
OpenCode version
1.0.203
Steps to reproduce
Just code with Opus long enough until it comes time to compact.
When configuring skills and/or MCPs this bug becomes more prominent. It seems the auto-compaction logic is not taking into account the tokens used to send the available tools.
I currently have to keep an eye on all my running sessions to manually type /compact followed by Continue what you were doing (which can be queued without waiting for compaction to end).
I'm tested with providers Antigravity (through the auth plugin), Vertex and OpenRouter in case it was some rule that differs per provider. Happens with all of them.
I don't mean to be a bother, but this issue persists on 1.1.59 and significantly impacts usability. When I'm on a deep run with Opus and encounter this error, I have to go back to an earlier point in the chat and manually compact from there, losing all the valuable context accumulated between that point and the present.
The reason I think it is a problem with the taking tools into account is because the Context on the sidebar says 154k tokens, but the request fails saying that 204k tokens is above the limit of 200k (which it clearly is).
When invoking /compact, the request is sent without the description of all the tools, just with the instruction to compact the context, so that request has still less than 160k tokens and works.
The reason I think it is a problem with the taking tools into account is because the Context on the sidebar says 154k tokens, but the request fails saying that 204k tokens is above the limit of 200k (which it clearly is).
This is my observed behavior. I'm in contact with @rekram1-node
Activity
github-actions commentedon Dec 28, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
DamianB-BitFlipper commentedon Dec 28, 2025
#6068 seems related.
Fryuni commentedon Feb 10, 2026
When configuring skills and/or MCPs this bug becomes more prominent. It seems the auto-compaction logic is not taking into account the tokens used to send the available tools.
I currently have to keep an eye on all my running sessions to manually type
/compactfollowed byContinue what you were doing(which can be queued without waiting for compaction to end).R44VC0RP commentedon Feb 10, 2026
@Fryuni what version & model are you using? Opus I assume?
DamianB-BitFlipper commentedon Feb 10, 2026
Yup. Running in to this issue recently. On Opus 4.6. opencode 1.1.53
rekram1-node commentedon Feb 10, 2026
yeah ill fix this
Fryuni commentedon Feb 10, 2026
Same as Damian. Opus 4.6 using version 1.1.53
I'm tested with providers Antigravity (through the auth plugin), Vertex and OpenRouter in case it was some rule that differs per provider. Happens with all of them.
DamianB-BitFlipper commentedon Feb 11, 2026
I don't mean to be a bother, but this issue persists on 1.1.59 and significantly impacts usability. When I'm on a deep run with Opus and encounter this error, I have to go back to an earlier point in the chat and manually compact from there, losing all the valuable context accumulated between that point and the present.
rekram1-node commentedon Feb 11, 2026
Hmm im surprised u still hit it reliably. Im making it impossible to break session but can u send me a session by chance?
I've never replicated this bug once without intentionally blowing up context by making a bunch of super long prompts and disabling auto compact
DamianB-BitFlipper commentedon Feb 11, 2026
Is there a way I can share you the session, but not publicly on GH here?
rekram1-node commentedon Feb 11, 2026
@DamianB-BitFlipper can u dm me on discord? Or email me: aiden@anoma.ly
to share a session do this:
opencode export > session.json(run this command in ur terminal) and then send me session.jsonThis will give me a raw json export of it that I can analyze
Fryuni commentedon Feb 11, 2026
The reason I think it is a problem with the taking tools into account is because the Context on the sidebar says 154k tokens, but the request fails saying that 204k tokens is above the limit of 200k (which it clearly is).
When invoking
/compact, the request is sent without the description of all the tools, just with the instruction to compact the context, so that request has still less than 160k tokens and works.DamianB-BitFlipper commentedon Feb 11, 2026
This is my observed behavior. I'm in contact with @rekram1-node
rekram1-node commentedon Feb 11, 2026
I stg will kill this bug this week I know how annoying it's been for users
github-actions commentedon May 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.