anomalyco / anomalyco/opencode

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

Open
#40,241 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 3, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

  • OpenCode: current dev branch; implementation is in PR #40239
  • Provider: organization-managed LLM provider with a one-minute limit window
  • Scope: provider/API response handling; not OS-specific

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.