Skip to content

Silent failure: opencode provider returns 500 errors but client drops response without showing error #38644

Description

@JebsApple

Description

When using opencode/big-pickle (the built-in opencode provider), intermittent AI_APICallError: Internal server error (500) responses cause the agent to silently stop responding. The user sees the spinner ("thinking...") for a while, then the flow cuts with no output, no error message, and no indication anything went wrong.

From the logs, I can see the client retries internally (multiple stream error entries followed by new stream attempts), but after exhausting retries it silently drops the response instead of surfacing the error to the user.

Log evidence

Here's a sample from ~/.local/share/opencode/log/opencode.log:

timestamp=... level=INFO run=eba88ab6 message=stream providerID=opencode modelID=big-pickle session.id=ses_XXX small=false agent=build mode=primary
timestamp=... level=INFO run=eba88ab6 message="llm runtime selected" llm.runtime=ai-sdk llm.provider=opencode llm.model=big-pickle
timestamp=... level=ERROR run=eba88ab6 message="stream error" providerID=opencode modelID=big-pickle session.id=ses_XXX small=false agent=build mode=primary error.error="AI_APICallError: Internal server error"
timestamp=... level=INFO run=eba88ab6 message=stream providerID=opencode modelID=big-pickle ... (retry)
timestamp=... level=ERROR run=eba88ab6 message="stream error" ... error.error="AI_APICallError: Internal server error" (again)

This pattern repeats 3-6+ times per user message. Sometimes it eventually succeeds, sometimes it silently fails.

Key observations

  1. The 500 errors are from the opencode provider backend — not a client-side issue
  2. The small=true path (title agent) shows a visible retry error (AI_RetryError: Failed after 3 attempts)
  3. The small=false path (build/main agent) fails silently — no error shown to the user
  4. No chunkTimeout is configured for the opencode provider — only openrouter has one in my config
  5. Related to SSE stream silently dropped mid-response hangs session/subagents forever — chunkTimeout has no default on the openai path #37580 (chunkTimeout has no default) but this is a distinct issue: the server actively returns 500s, not a silent stall

Environment

  • opencode version: 1.18.4
  • OS: Linux (NixOS)
  • Model: opencode/big-pickle
  • Provider: opencode (built-in)
  • No custom provider options for the opencode provider

Expected behavior

When the provider returns a 500 error and retries are exhausted, opencode should:

  1. Show the error to the user (not silently drop it)
  2. Or at minimum log a clear "giving up after N retries" message

Workaround

Adding provider.opencode.options.chunkTimeout may help with silent stalls, but doesn't address the 500 error handling.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions