Skip to content

ACP: provider status and rate-limit headers of API errors are dropped #52860

Closed as not planned

Description

@benediktkraus

Description

When a prompt fails with an APIError in opencode acp, the client only gets -32603 with data: {service, errorName}. The APIError already carries statusCode, isRetryable and responseHeaders, but promptResponse in packages/opencode/src/acp/service.ts drops them. An ACP client therefore cannot tell a 429 from any other provider failure, and cannot see when it may try again (retry-after, x-ratelimit-reset).

Example with an OpenRouter free model after the daily limit is used up:

{"code":-32603,"message":"Internal error: Rate limit exceeded: free-models-per-day-high-balance.","data":{"service":"session","errorName":"APIError"}}

The provider answered 429 with x-ratelimit-reset: 1790985600000; neither reaches the client.

Expected: the error data includes statusCode, isRetryable and responseHeaders of the APIError.

Plugins

none

OpenCode version

1.18.34

Steps to reproduce

  1. Use up the daily free limit of an OpenRouter free model.
  2. acpx --format json --agent "opencode acp" --model openrouter/qwen/qwen3.8-27b:free exec "hi"
  3. The JSON-RPC error has no status and no headers.

Operating System

Linux x86_64, macOS 26 arm64

Terminal

none (ACP over stdio)

Activity

  1. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

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

    • #47804: ACP clients do not receive provider quota errors or retry status when a Go quota limit is reached.
    • #50743: Requests forwarding provider retry status and error details to ACP clients.
    • #48297: Covers structured APIError.data.statusCode handling in the ACP service, specifically mapping 401/403 errors.
  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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