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
Auto-compact fails for Bedrock-hosted Claude models due to incorrect context limit #16356
I'm using Opus 4.6 via Amazon Bedrock in OpenCode. Auto-compaction is not happening, resulting in broken sessions.
Claude suggests this is an issue with models.dev reporting the Anthropic token limit rather than the Bedrock one.
In a session, at the top of the sidebar I see "200,084 tokens" and "20% used", indicating a 1M token limit.
But at this point the session has the error undefined: The model returned the following errors: prompt is too long: 200148 tokens > 200000 maximum.
If I try to manually /compact, that fails too: undefined: The model returned the following errors: messages.5.content.6: thinkingorredacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.
The only thing I can do is abandon the session.
Expected Behavior
OpenCode should use the correct 200k token limit that Bedrock uses (maybe by fixing what models.dev reports).
Workaround
Override the limit in ~/.config/opencode/opencode.json:
Activity
github-actions commentedon Mar 6, 2026
This issue might be a duplicate of existing issues. Please check:
prompt is too long: ... > 200000 maximum) with Claude Opus 4.6 (Global) on Amazon Bedrock — incorrect context limit causing session failuresnathanl commentedon Mar 6, 2026
I do think this is a duplicate issue, so I'm closing it.