anomalyco / anomalyco/opencode
Preserve HTTP status on UnknownError so plugins can fallback
@nexxeln is already working on this.
Since Sep 3, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Provider HTTP failures (401, 429, 5xx, auth-expired) are often collapsed to UnknownError with Unexpected server error and no status on the session error. Plugins that implement model/provider fallback cannot classify the failure.
Related: https://github.com/anomalyco/opencode/issues/39340 (overloaded_error becomes UnknownError and is not retried).
Repro
- Point a provider baseURL at https://gateway.example/v1.
- Have the gateway return 401 or 429 on chat completions.
- opencode run -m provider/model-id ping
Actual
CLI prints UnknownError / unexpected server error. Session error object has no HTTP status.
Expected
Session error includes status (or original provider error name) so plugins can hop. User-visible message should include the status when known.
Suggested fix
Propagate status / error.name from the AI SDK / fetch layer onto session.error instead of wrapping everything as UnknownError.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.