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
HTML error pages from gateways/proxies produce unreadable terminal output #15406
When OpenCode is used behind a gateway or proxy (e.g. Cloudflare Access) that returns HTML error pages for 401/403 responses, the error handler dumps raw HTML into the terminal:
This happens because the message() function in packages/opencode/src/provider/error.ts concatenates the status text with responseBody when JSON parsing fails. When the upstream returns HTML instead of JSON, the result is unreadable.
Expected behavior
A clean, actionable message like:
Unauthorized: request was blocked by a gateway or proxy. Your authentication token may be missing or expired — try running `opencode auth login <your provider URL>` to re-authenticate.
Steps to reproduce
Configure OpenCode with a provider behind a gateway that requires authentication (e.g. via opencode auth login)
Let the auth token expire or skip authentication
Send a message — the gateway returns an HTML 401 page
OpenCode displays raw HTML in the terminal
Environment
Affects any setup where a proxy/gateway sits between OpenCode and the LLM provider and returns HTML error responses
Activity