Skip to content

sglang token exedeeded count is not being recognized for auto compact #25231

Closed as not planned

Description

@koush

Description

Bad Request: Requested token count exceeds the model's maximum context length of 202752 tokens. You requested a total of 202941 tokens: 170941 tokens from the input messages and 32000 tokens for the completion.
Please reduce the number of tokens in the input messages or the completion to fit within the limit.

That's what sglang is returning

Plugins

No response

OpenCode version

1.14.30

Steps to reproduce

  1. exceed context length in open code on an sglang (openai compatible). open code does not recover.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. added
    bugSomething isn't working
    on May 1, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 1, 2026
  3. github-actions commented on May 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is specific to sglang's OpenAI-compatible endpoint returning this error shape (as opposed to a standard context_length_exceeded code), feel free to clarify that distinction so it can be tracked separately.

  4. Arjxm commented on May 1, 2026

    @Arjxm

    I love to work on this

  5. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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