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
"The input is too long for the selected model." error when opencode sends a message with too many tokens (auto-compaction is not triggered) #57412
Sometimes, i get a "The input is too long for the selected model." error from my custom model endpoint. The message is not included in the standard auto-compaction trigger sentences.
I think a custom option to add to this list of compaction triggering error messages for a custom endpoint could be a useful addition. Custom endpoints may have custom error messages and this would improve compatibility overall.
Plugins
none
OpenCode version
2.0.31 Desktop
Steps to reproduce
Send a too long message to an endpoint whcih replies with an error message that does not yet trigger auto-compaction
To restate it: you'd like to be able to add your own provider error messages to the list that triggers auto-compaction, so custom endpoints with their own wording still get compacted instead of failing.
What's happening: OpenCode decides an error means "context overflow" by matching its text against a fixed list of known phrases. That list has input is too long for requested model, but your endpoint says input is too long for the selected model, so it doesn't match and compaction never starts. Right now there's no setting or plugin hook to add your own phrases. Maintainers will consider both broadening the built-in phrase and making the list configurable.
Activity
opencode-agent commentedon Oct 20, 2026
Thanks for the report and the suggestion!
To restate it: you'd like to be able to add your own provider error messages to the list that triggers auto-compaction, so custom endpoints with their own wording still get compacted instead of failing.
What's happening: OpenCode decides an error means "context overflow" by matching its text against a fixed list of known phrases. That list has
input is too long for requested model, but your endpoint saysinput is too long for the selected model, so it doesn't match and compaction never starts. Right now there's no setting or plugin hook to add your own phrases. Maintainers will consider both broadening the built-in phrase and making the list configurable.Related issues:
ContextWindowExceededErrorwording not recognised