Unhandled case: [object Object] shown when SDK stream ends with had_error after API stall — breaks conversation continuity
Summary
When the Anthropic API SSE stream stalls mid-tool-call, the next bash tool dispatch aborts with a generic "Shell command failed" error and the stream ends with had_error=true / no result. The VSCode UI fails to render this state gracefully and shows Unhandled case: [object Object] in the chat. The conversation cannot be resumed normally — on reload, the in-progress turn is lost.
Environment
- Claude Code extension:
cc_version=2.1.141.149(cc_entrypoint=claude-vscode) - VSCode: 1.120.0 (commit
0958016b2af9f09bb4257e0df4a95e2f90590f9f) - macOS Darwin 25.4.0
- Model: Opus 4.7 (1M context)
Expected behavior
When the SDK stream errors out, the UI should:
- Render a friendly error in chat (e.g. "Connection interrupted — tap to retry") instead of the raw
Unhandled case: [object Object]string. - Preserve the conversation so reloading the panel doesn't lose the prior turn.
Actual behavior
Sequence from the extension log (relevant excerpts):
\\\\
10:06:58.759 [WARN] [Stall] tool_dispatch_end tool=Bash outcome=error durationMs=24
10:06:58.759 [DEBUG] Bash tool error (24ms): Shell command failed
10:08:26.531 sdk_stream_ended_no_result {"had_error":true, "message_count":177}
\\
\\\\
10:12:43.017 [WARN] Streaming stall detected: 43.5s gap between events (stall #1)
10:12:46.045 [WARN] [Stall] tool_dispatch_end tool=Bash outcome=error durationMs=27
10:12:46.045 [DEBUG] Bash tool error (27ms): Shell command failed
10:12:29.490 sdk_stream_ended_no_result {"had_error":true, "message_count":199}
\\
Repro pattern observed: a 5-call parallel Bash batch where the first call sits in the permission UI for ~30s, then calls 2–5 fire back-to-back within ~70ms. The 3rd shell spawn fails with a sub-100ms error. Also reproduces on a single bash call whose output is large (~333KB image extraction via \magick\) — looks like API SSE backpressure or response size correlates.
Impact
The UI's \Unhandled case: [object Object]\ is a dead end: no retry button, no error context, and reloading the panel loses the in-flight turn entirely. For long planning / coding sessions this is severe — a 90-minute session can be lost to one stall.
Suggested fixes (priority order)
- Catch the unhandled error in the chat renderer and show a friendly message + retry affordance.
- Persist the in-flight turn before reload so resume works after a stream error.
- Investigate the underlying stream stall — large tool outputs or parallel bash batches seem to correlate.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗