anomalyco / anomalyco/opencode

API 404 error silently hangs session in 'thinking' state with no error recovery

Open
#38,951 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When the upstream API returns an HTTP 404 error (e.g., model not found, wrong endpoint path, or deleted model), OpenCode silently hangs in the "thinking..." state indefinitely. No error message is shown to the user, no timeout or retry mechanism kicks in, and the session becomes completely unresponsive. The only recovery is to kill the process or restart the app.

This is distinct from stream errors during active streaming (#32366) — the 404 happens at the initial API request before any stream starts, yet produces the same stuck-in-thinking symptom.

OpenCode version

1.17.13 (also observed on earlier versions)

Steps to reproduce

  1. Configure an OpenAI-compatible provider with an incorrect API endpoint (e.g., https://api.example.com/v1/chat/completions that returns 404)
  2. Or use a model name that does not exist on the provider
  3. Send any message to start a session
  4. Observe: UI shows "thinking..." immediately but never transitions to either a response or an error state
  5. The session stays stuck indefinitely — no cancel button, no error toast, no timeout recovery

Expected behavior

  1. Show an error message when the API returns 404 (e.g., "Model not found" or "API endpoint unavailable")
  2. Transition out of "thinking" state — either auto-retry with fallback or surface the error and return to idle
  3. Client-side timeout to prevent indefinite stuck states when the API fails to respond properly

Additional context

The same class of issue has been reported for different error triggers:

  • #32366 — stuck on thinking after stream errors (socket close, empty errors)
  • #38644 — 500 errors silently dropped without user notification
  • #33055 — ACP session/prompt hangs on model API error

This issue specifically covers the HTTP 404 trigger case, which may need a slightly different fix (the error occurs before stream initiation, so stream-level error handling does not apply).

Operating System

macOS (darwin arm64)

Terminal

N/A (primarily affects Desktop GUI and TUI modes)

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.