Skip to content

[Bug] Provider-specific HTTP 400 rate-limit responses stop processing #40241

Closed as not planned

Description

@maximkr

Description

In some organizations, LLM limits are configured for a one-minute window rather than a long-term quota. When the provider returns HTTP 400 with a JSON detail containing rate limit exceeded, OpenCode currently treats the response as a terminal processing failure instead of retrying the request.

This stops the current session even though the request may succeed after the one-minute limit window resets.

Steps to reproduce

  1. Configure an organization-managed LLM provider with a one-minute request or token limit.
  2. Send a prompt until the provider limit is reached.
  3. Receive an HTTP 400 response with a JSON body containing a detail field whose value is rate limit exceeded.
  4. Observe that OpenCode stops processing instead of entering the existing retry flow.

Expected behavior

OpenCode should retry this provider-specific HTTP 400 rate-limit response using the existing retry flow, while keeping generic HTTP 400 client errors non-retryable.

The behavior should be opt-in per provider because HTTP 400 rate-limit responses are non-standard:

provider:
  my-provider:
    options:
      retry400RateLimit: true

When the option is disabled or absent, the current non-retryable behavior should remain unchanged.

Environment

Activity

  1. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

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

  2. added a commit that references this issue on Aug 3, 2026
    fbec967
  3. github-actions commented on Oct 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