anomalyco / anomalyco/opencode

Preserve HTTP status on UnknownError so plugins can fallback

Open
#47,039 2 comments 0 reactions 1 assignee View on GitHub

@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

  1. Point a provider baseURL at https://gateway.example/v1.
  2. Have the gateway return 401 or 429 on chat completions.
  3. 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

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.