You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Claude/Anthropic 500/502/503/504 server errors are not retried #21420
When Anthropic's API returns a transient server error (HTTP 500, 502, 503, or 504), OpenCode does not retry the request — it immediately fails with an error like:
{"type":"api_error","message":"Claude API returned a server error. This is usually temporary — try again in a moment."}
Expected behavior
Transient server errors should be retried with exponential backoff, the same way rate-limit errors (429) and overload errors (529) already are.
Root cause
In packages/opencode/src/provider/error.ts, parseAPICallError() trusts input.error.isRetryable from the Vercel AI SDK for non-OpenAI providers. The @ai-sdk/anthropic package only marks status codes 429 and 529 as isRetryable: true. Generic 500/502/503/504 responses get isRetryable: false, so SessionRetry.retryable() returns undefined and the retry loop stops immediately.
OpenAI already has a special override in isOpenAiErrorRetryable() — the same approach needs to be applied universally.
Closing as a duplicate of #19394. Both describe the same Anthropic 5xx APICallError retry-classification path in packages/opencode/src/provider/error.ts.
Activity
github-actions commentedon Apr 8, 2026
This issue might be a duplicate of existing issues. Please check:
If you believe this is distinct, please clarify how it differs from the above (especially #19394, which describes the same root cause in
error.ts).rich-jojo commentedon Apr 24, 2026
Closing as a duplicate of #19394. Both describe the same Anthropic 5xx APICallError retry-classification path in packages/opencode/src/provider/error.ts.