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
Bug: Claude/Anthropic 500/502/503/504 server errors are not retried #21422
When Anthropic's API returns a transient server error (HTTP 500, 502, 503, or 504), OpenCode immediately fails with no retry:
{"type":"api_error","message":"Claude API returned a server error. This is usually temporary — try again in a moment."}
The same infrastructure already retries 429 and 529 — but 500/502/503/504 are silently dropped.
Root cause
parseAPICallError() in packages/opencode/src/provider/error.ts trusts input.error.isRetryable from the Vercel AI SDK for non-OpenAI providers. The @ai-sdk/anthropic package only sets isRetryable: true for 429 and 529. HTTP 500/502/503/504 get isRetryable: false, so SessionRetry.retryable() returns undefined and the retry loop exits.
OpenAI already has a isOpenAiErrorRetryable() override — the same pattern needs to apply universally.
Steps to reproduce
Configure Anthropic as provider
Trigger or wait for a 500/502/503/504 response (during outages or high load)
Observe: immediate error with no retry attempt
Expected behavior
OpenCode should retry 500/502/503/504 with exponential backoff, the same as 429/529.
Activity
github-actions commentedon Apr 8, 2026
This issue might be a duplicate of existing issues. Please check:
error.tsPlease check if any of these already cover your report.