Skip to content

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

Closed

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.

Activity

  1. github-actions commented on Jul 24, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. aentrepreneur commented on Aug 11, 2026

    @aentrepreneur

    Additional quantitative evidence from a long-running Linux setup (Ubuntu 24.04 / WSL2, opencode 1.18.16, provider opencode, model big-pickle, no custom provider options).

    Aggregating ~/.local/share/opencode/log/opencode.log, AI_APICallError: Internal server error from providerID=opencode modelID=big-pickle occurred 409 times.

    By day (UTC):

    Date Count
    2026-07-22 34
    2026-07-23 64
    2026-07-24 172
    2026-07-27 130
    2026-07-28 4
    2026-08-11 1

    By agent (main path, small=false):

    • build: 241
    • plan: 135
    • compaction: 18 (not mentioned in the original report — /compact also fails, leaving sessions to grow unbounded)
    • explore: 6
    • general: 4

    Behavior matches the report exactly: 3-6 stream error entries followed by new stream retries per message; when retries are exhausted the response is silently dropped with no error surfaced to the user. It correlates with degraded backend periods (heavy on Jul 24 and Jul 27), so it appears to be server-side on the opencode provider, and it is still occurring as of 2026-08-11 (opencode 1.18.16).

    The compaction agent being affected (18 occurrences) is an additional data point: failed compactions never complete and the session context keeps growing. Worth tracking alongside the silent-drop behavior.

  3. aentrepreneur commented on Aug 16, 2026

    @aentrepreneur

    Adding a fresh data point: beyond AI_APICallError: Internal server error (my earlier quantitative comment), I’m now seeing providerID=opencode modelID=big-pickle fail with socket-level disconnects that also result in user-visible silent drops.

    Last 5 minutes (UTC)

    From ~/.local/share/opencode/log/opencode.log (OpenCode 1.18.18, Linux/WSL2):

    • stream error socket closed for big-pickle: 2
    • error=Aborted: 6

    Verbatim examples:

    timestamp=2026-08-16T23:51:13.948Z level=ERROR run=042c53b4 message="stream error" providerID=opencode modelID=big-pickle session.id=ses_ff3194081ffebphxmz8WESfcYH small=false agent=build mode=primary error.error="AI_APICallError: Cannot connect to API: The socket connection was closed unexpectedly ..."
    
    timestamp=2026-08-16T23:53:54.387Z level=ERROR run=042c53b4 message="stream error" providerID=opencode modelID=big-pickle session.id=ses_ff3194081ffebphxmz8WESfcYH small=false agent=compaction mode=primary error.error="AI_APICallError: Cannot connect to API: The socket connection was closed unexpectedly ..."
    

    This aligns with #32366 (UI stuck/silent after stream error). I opened a dedicated issue for this failure mode as well and cross-linked it.

  4. aentrepreneur commented on Sep 13, 2026

    @aentrepreneur

    Update (v1.18.30, 2026-09-12) — Internal-server-error class: no recurrence on the current build

    Same environment as my evidence (Ubuntu 24.04/WSL2, opencode/big-pickle, no custom provider options). Today's full-day log:

    Proposal: given zero recurrence on v1.18.30 plus the 1.18.27 timeout default, this class looks addressed and/or backend-stabilized. Suggest closing, or folding any remaining verification into #42950 (canonical for the stream-failure family). I'll report back if the 500s resurface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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