Unhandled case: [object Object] on stream end with had_error: true after long sessions
Status Closed — duplicate
Reported on v2.1.141
Maintainer reply ✓ Yes — claude[bot]
Workaround ✓ Mentioned in thread ↓
Activity 13 comments · opened May 14, 2026 · closed May 15, 2026
💡 Likely answer: A maintainer (claude[bot], contributor)
responded on this thread — see the highlighted reply below.
What happened
Mid-response in a long-running VS Code conversation, the UI shows
"Unhandled case: [object Object]" in a red error bar. The session
becomes unresponsive (Thinking... never resolves). Sometimes typing
"continue" recovers, sometimes not — it's a gamble.
Reproduction (consistent pattern in logs)
- Long-running conversation (40+ messages, multiple large MCP
tool results — 90KB+ persisted read-results in my case)
- Tool call completes successfully
- Follow-up API request sent
- Stream starts, delivers a few hundred bytes
- Stream stalls for 15s with no further chunks
sdk_stream_ended_no_resultfires withhad_error: true- UI surfaces "Unhandled case: [object Object]"
Log excerpt
[Stall] tool_dispatch_end tool=mcp__JARVISVault__list_directory outcome=ok durationMs=4
[API REQUEST] /v1/messages source=sdk
Stream started - received first chunk
[WARN] [Stall] stream_idle_partial lastChunkAgeMs=15010 bytesTotal=669
log_event sdk_stream_ended_no_result {"had_error":true,"message_count":41}
Expected
Either:
- Automatic retry of the failed stream, OR
- A user-facing error with a "Retry" / "Resume" button, OR
- At minimum, a meaningful error message instead of
[object Object]
Environment
- Extension version: 2.1.141.672 (also reproduced on 2.1.141.752)
- VS Code on Windows 11
- Model: Opus 4.7 (1M context)
- MCP servers active: ~20 (heavy MCP usage)
Impact
In long content-heavy sessions (vault analysis, document audits, etc.)
this fires multiple times per hour. The workflow becomes a gamble of
"does retry work this time".
13 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
---
Same signature on Windows 11 + Git Bash — and I think I can name the stall trigger.
Reproduced this with a near-identical log signature (
stream_idle_partial lastChunkAgeMs=15011 bytesTotal=654), v2.1.141, Opus 4.7 1M, VS Code on Windows 11.What I can add: in my case the 15s stall is not driven by long sessions or large MCP results — it's driven by Bash tool latency, and that latency traces directly to the Git Bash shell snapshot. This connects this issue to #46015.
The chain:
/etc/profile.d/git-prompt.shsourcesgit-completion.bash— 142 functions, ~92KB — into every shell.eval. A Unicode-character cwd path adds more spawn friction.tool_dispatch_end tool=Bash durationMs=19630). During that window no stream chunks flow → the 15sstream_idle_partialwatchdog fires →had_error: true→ the webview parser hitsQB1→Unhandled case: [object Object].So #46015 (snapshot bloat) and this issue aren't separate — the snapshot bloat is a trigger for the stall described here.
Local workaround that removes the trigger — strip git-completion only when running under Claude Code (
CLAUDECODE=1is set in CC shells), so normal terminals keep completion. In~/.bashrc:This drops the snapshot from ~87KB to ~580 bytes (144 functions → 1) and Bash calls back under a second — no more stalls. Normal terminals are untouched.
Proper fix is server/extension-side (others have noted this): the webview parser shouldn't throw on a stalled/truncated stream — it should degrade or offer Retry. But independently, Claude Code building its shell snapshot from a non-interactive shell (or skipping completion functions) would eliminate this whole trigger class on Windows.
same issue here
Correction to my comment above — the Bash-latency attribution was wrong (or at most secondary).
After pulling my own VS Code extension logs, the data contradicts what I claimed. Being transparent since this thread is getting traction:
What the logs actually show — of 23 stalls in one session, 13 were
stream_idle_partial ... bytesTotal=0— the stream opens and receives zero bytes for 15s+. One line reads[WARN] Slow first byte: no stream chunk 30.0s after request sent. That's not Bash blocking event flow — it's the API stream itself hanging before any data arrives.These
bytesTotal=0stalls correlate with large context (mymessage_countclimbed 160 → 218 in the session) on Opus 4.7 1M — slow time-to-first-token exceeding the 15s watchdog. So the OP's original framing ("after long sessions / large results") was right; my "it's Bash, not long sessions" claim was not.Where Bash latency does fit — as a secondary contributor. Slow Bash calls also create event-flow gaps, and on Windows the Git Bash shell snapshot (~87KB of git-completion functions) made each call ~15-20s. The
~/.bashrcworkaround above does fix that — Bash dropped from ~21s to ~1.3s in my logs. But the crashes continued anyway, driven by thebytesTotal=0first-byte stalls. That's the proof Bash latency wasn't the primary driver.Net — the stall behind this crash is multi-causal: slow time-to-first-token on large contexts is dominant, slow Bash is minor. Chasing individual triggers won't fully solve it. The only robust fix is the one in #58897/#58994: the webview's
QB1helper must not throw on a stalled/unrecognized stream event — log and continue instead. I'm running a local patch that neutralizes theQB1throw, and the webview no longer crashes regardless of what causes the stall.Same issue here on Windows, VS Code extension, May 14 2026.
Logs match the pattern exactly:
UI shows the red "Unhandled case: [object Object]" bar and Thinking... never resolves. Typing
continueworks maybe half the time;Developer: Reload Windowis more reliable but I lose the in-flight turn.Repros consistently in long review/refactor sessions with multiple Read MCP calls. Happy to share more logs if useful.
Reproducing this on Windows / VS Code extension 2.1.141 with a notably short session —
message_count: 22,autocompact level=ok,effectiveWindow=980000. So the trigger isn't strictly long sessions.Environment
Trigger
Invoked the Impeccable
/critiqueskill on a specific page in my project. SeveralReadtool calls succeeded, then the next streaming request stalled and died.Log excerpt
12:09:23.003 [DEBUG] Stream started - received first chunk
12:09:38.006 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15004 bytesTotal=671 idleDeadlineMs=300000
12:09:53.043 [event] sdk_stream_ended_no_result {"had_error":true,"subagent_count":0,"message_count":22}
12:10:05.534 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15002 bytesTotal=707
12:10:20.533 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=30000 bytesTotal=707
12:10:30.714 [WARN] Streaming stall detected: 67.7s gap between events (stall #1)
UI rendered "Unhandled case: [object Object]". Session became unresponsive; typing "continue" did not recover.
Notes that may help narrow it down
subagent_count: 0— no Task/subagent involvement.Update: Rolled back the VS Code extension to 2.1.140 bug completely gone. Same project (Next.js + Supabase + ~20 MCP servers), same long-session workflow (review/refactor across multiple files), no more
Unhandled case: [object Object], nostream_idle_partialwarnings, no stalledThinking....Nothing else changed in my environment between the broken state and the fix — just the extension version.
Something shipped between 2.1.140 and 2.1.141 broke long-session stream handling. Hope this helps narrow it down.
Reproducing on VS Code extension 2.1.141 + Opus 4.7 (1M context) on Windows 11 today (2026-05-14). Three additive data points beyond what's already in this thread, and one correlated condition that may help narrow the trigger.
Data points
message_count: 453(vs the 22 / 41 / 320 already reported). Together with @alec-harden's 22-message repro, this strengthens the "not strictly long-session" framing — the bug just gets more probable on long sessions, not gated by them./resumewith no work loss — the underlying agent continued executing tools (commits, file edits, memory writes) to disk while the chat UI was wedged. So it's a renderer-only failure, not an agent-loop failure. Useful for narrowing the responsible code path to the webview-side stream consumer.Claude VSCode.logmatched the pattern exactly:``
`21:45:50 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15008 bytesTotal=675 idleDeadlineMs=300000
21:46:05 log_event sdk_stream_ended_no_result {"had_error":true,"subagent_count":0,"message_count":453}
21:46:14 [WARN] Streaming stall detected: 39.0s gap between events (stall #1)
Unhandled caseNotably zero hits for
or[object Object]*anywhere* in the extension-host log — the banner is constructed at a UX boundary that swallows the structured payload, so the host log alone never shows you the discriminator that wasn't matched. Anyone debugging this in source: instrument the webview-side stream-event switch'sdefault` arm to dump the unmatched object first.Correlated condition (worth checking on the maintainer side)
In my session,
/remote-controlwas toggled on 30 minutes before the first crash:…and never received a corresponding success/handshake confirmation in the log. No banner appeared above the textbox locally. But the phone app did register a connected session — and showed messages syncing through to the agent-fanout point in the conversation, then stopped. After that point, none of the post-fanout messages reached the phone.
That's a textbook half-state: extension-host thinks the remote bridge isn't fully established (no banner), phone-side thinks it is (sees the session). When the streaming response then has to fan out to both the local UI and the remote bridge, the bridge's discriminated-union dispatcher hits a case it has no arm for → falls into the same
default:that producesUnhandled case: [object Object].The 3 crash timestamps in my session correlate with the 3 highest-volume tool batches (a 5-way agent fanout + two large multi-file Edit batches). Each new batch added more pressure to the bridge fanout. If the maintainer team can repro by enabling remote-control + running a long agent-heavy session, this might be a faster repro path than waiting for natural network stalls. I've filed the half-state separately so this thread stays focused on the unhandled-case symptom.
Workaround confirmation
@dcloutier2025's report that rolling back to 2.1.140 eliminates the issue lines up with my experience too — I had no occurrences of this banner across multiple long sessions on the prior extension version. Strongly looks like a 2.1.141-specific regression in either the webview stream consumer or the remote-bridge serializer.
Adding a macOS data point, every prior report in this thread is Windows 11.
Reproducing on macOS (Darwin 24.6.0) with the Claude Code VS Code extension. Symptom matches exactly: red "Unhandled case: [object Object]" banner, "Thinking…" never resolves, sometimes recoverable by typing continue, more reliably by Developer: Reload Window (losing the in-flight turn). Hitting this multiple times per day in normal coding sessions.
Important: the 2.1.140 rollback does not fix it on macOS. I was on 2.1.141, rolled back to 2.1.140 (which @dcloutier2025 reported as clean on Windows), and the banner still fires with the same signature. So either:
the regression range goes back further than 2.1.140 on macOS, or
there's a macOS-specific stream-consumer path that's broken in both versions, or
@dcloutier2025's Windows fix is coincidental (sessions happened to avoid the trigger after the downgrade).
Either way, this isn't a clean "rollback to N-1" workaround across platforms. Combined with the macOS repro, it also weakens the Windows-specific theories (Git Bash snapshot, etc.) as the primary cause — the underlying QB1/webview throw on unrecognized stream events looks platform-agnostic.
Happy to grab a Claude VSCode.log excerpt next time it fires.
AI USAGE: was written by Claude code and slightly edit by me.
+1 seeing this repeatedly. Using Ubuntu 24.04.4 LTS
Posting a working local fix — feel free to paste this whole comment into Claude Code and have it apply the patch for you.
Following up on my earlier comments: I've been running a local patch for a day now and the webview no longer crashes, regardless of what causes the underlying stall.
The root cause is one helper in the bundled webview parser. In the extension's
webview/index.jsthere's an assert-never helper that throws on any stream event it doesn't recognize — a network stall, a truncated chunk, or a new server event type. That single throw takes down the entire webview render, even though the CLI backend keeps working fine.The fix is to make it log-and-continue instead of throw. Find this exact string in
webview/index.js:Replace it with:
That's the whole fix. The UI now skips the unknown event instead of dying.
Notes for anyone applying this:
~/.vscode/extensions/anthropic.claude-code-<version>/webview/index.js.SessionStarthook so it re-applies automatically).This is symptom-agnostic — it doesn't matter whether your stall comes from slow first-byte on a big context, slow Bash, or anything else. The real bug is the webview throwing instead of degrading, and this fixes that directly. Ideally the maintainers ship the same change server/extension-side so nobody has to patch their install.
This is a duplicate of #58897, which was fixed as of version 2.1.142.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.