Skip to content

"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

Closed

Description

@GenosseFlosse

Description

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

  1. Send a too long message to an endpoint whcih replies with an error message that does not yet trigger auto-compaction
  • Actual bahavior: Auto-compaction not triggered.
  • Expected behavior: trigger auto compaction.

Screenshot

Image

Operating System

Windows 11

Terminal

none, I use the desktop app

Activity

  1. opencode-agent commented on Oct 20, 2026

    @opencode-agent
    Contributor

    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 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.

    Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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