Repository navigation
Description
Summary
When the streaming connection to the API stalls and the SDK gives up with had_error: true, the Claude Code VS Code extension's webview shows a generic toast reading Unhandled case: [object Object] instead of a user-meaningful message. The error object is passed straight into a default switch case and serialized via implicit String(), producing [object Object].
This blocks the visible stream — from the user's perspective, Claude has stopped working, and they have to dismiss the toast (or reload the webview with Cmd+R) before the next interaction.
Environment
- OS: macOS 15 (Darwin 25.3.0), Apple Silicon
- VS Code: stable (latest)
- Claude Code extension: 2.1.141 (latest available, no update offered)
- Native binary: `claude` 2.1.141 from extension bundle
- Plan: standard (fast mode unavailable: extra usage billing)
Repro steps
- Open Claude Code in VS Code, start any session
- Wait for a moment when the network/API streaming stalls (occurs intermittently, multiple times per hour in our environment — exact trigger unknown, possibly correlated with API load or local network jitter)
- Observe: stream goes silent for 15+ seconds while you're awaiting a response
- Observe: SDK eventually emits `sdk_stream_ended_no_result` with `had_error: true`
- Observe the bug: an orange toast appears reading `Unhandled case: [object Object]` with links "View output logs" and "Troubleshooting resources"
Expected behavior
The toast should display a meaningful, user-facing message such as:
- "Connection stalled — retry?" (with retry button)
- "Stream ended unexpectedly — your message may be incomplete"
- Anything except a serialized object placeholder
Actual behavior
Toast displays the literal string `Unhandled case: [object Object]`. No actionable information. User must dismiss the toast and either retry the request or reload the webview (`Cmd+R` while panel has focus) to continue.
Log evidence
From `~/Library/Application Support/Code/logs/.../Anthropic.claude-code/Claude VSCode.log`:
```
2026-05-14T11:58:04.535Z [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15000 bytesTotal=656 idleDeadlineMs=300000
2026-05-14T11:58:19.551 webview event log_event sdk_stream_ended_no_result {had_error: true, subagent_count: 0, message_count: 74}
2026-05-14T11:58:24.785 [WARN] Streaming stall detected: 35.2s gap between events (stall #1)
2026-05-14T11:59:19.105 [WARN] Streaming completed with 1 stall(s), total stall time: 35.2s
```
Searching the standard log files (`Claude VSCode.log`, `renderer.log`, `exthost.log`) for `unhandled` or `object Object` returns zero matches — the toast text is rendered only in the webview and is not captured in the extension's host logs. This makes self-diagnosis hard for affected users.
Other recurring errors in the same session that may share the same UI default-case path:
```
[ERROR] MCP server "claude-vscode" Failed to fetch tools: MCP error -32601: Method not found
[ERROR] MCP server "claude.ai Netlify" Connection failed: Cloudflare 502 Bad gateway
[ERROR] MCP server "claude.ai Goodnotes" Anthropic Proxy: Invalid content from server
```
Suggested fix
In the webview's error-handling switch, replace the default branch:
```ts
default:
showToast(`Unhandled case: ${error}`); // implicit String(error) → "[object Object]"
```
with something like:
```ts
default:
console.error('Unhandled error case', error);
const message = error?.message ?? error?.error?.message ?? 'Unknown error';
showToast(`Stream interrupted: ${message}`, { action: 'Retry' });
```
That's a few-line change and immediately makes the failure mode actionable.
Impact
- Blocks user-visible stream rendering on every stall
- Users perceive the assistant as unresponsive even though the SDK is recoverable
- The toast text gives zero diagnostic information; "View output logs" opens a log channel that doesn't contain the toast text either
Activity
github-actions commentedon May 14, 2026
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
sigma512 commentedon May 14, 2026
Independent repro on the same build (
cc_version=2.1.141.bb8, macOS 15 / Darwin 25.3.0, VS Code stable). Confirming the failure mode in this issue exactly, and adding two observations:1. Same sequence in the host log:
After the toast, session state transitioned to
idleand the panel stopped rendering further output, matching the OP description (dismiss toast orCmd+Rreload to continue).2. Frequency: in a single morning across four VS Code windows on one machine, I see
sdk_stream_ended_no_result had_error:trueevents in windows 2, 3, and 4. The bb8 / 926 cc_version values alternate in the same log (looks like a rolling build/canary swap), and stalls appear on both. Stalls are typically ~15s oflastChunkAgeMsbefore the SDK gives up, well under the 300sidleDeadlineMs— so the SDK's own stall detector is firing aggressively and the webview's default error-case is what users actually see.The suggested fix in the OP (extract
error?.message ?? error?.error?.message) is the right shape, but the deeper fix is probably also surfacing a retry affordance on the toast — right now the only recovery is to retype the last message, which loses any in-flight tool calls.physppcf-png commentedon May 14, 2026
Thanks @sigma512 for the independent repro and the additional observations. Two things worth highlighting that came out of your data:
1. The SDK stall detector is the actual root cause, not network jitter.
Your observation that stalls fire at ~15s
lastChunkAgeMswhileidleDeadlineMsis 300s is the most important finding here. The SDK is giving up roughly 20x earlier than its own configured deadline. From the user's perspective the connection looks fine (other API calls succeed in parallel), but the SDK has already emittedsdk_stream_ended_no_resultwithhad_error: true. So the fix sequence is probably:idleDeadlineMsend-to-end, or expose a separatestreamIdleWarnMsand only error out at the deadline. As things stand, every brief network hiccup is treated as a fatal stream end.If only (2) gets done, users will get nicer toasts but still lose mid-task output multiple times per session. Both fixes together are needed.
2. Retry affordance: agreed, and worth being explicit.
Right now the only recovery is to retype the last message, which loses any in-flight tool calls. A retry button on the toast would need to:
Even just the third option (cleanest semantics, no SDK changes) would be a major UX improvement over the current state.
Frequency match for me too: hitting this multiple times in a single working session, across both
bb8and earlier builds.romankanevsky commentedon May 14, 2026
Confirming this on Windows + VS Code Remote-SSH (laptop -> Linux VM via vscode-server). Same trigger pattern, same outcome, plus one extra symptom not captured in the OP.
Environment
anthropic.claude-code-2.1.140(auto-resumed via launch_claude--resume)/home/<user>/.vscode-server/extensions/anthropic.claude-code-2.1.140/resources/native-binary/claudeclaude-opus-4-7(1M context, API Usage Billing)api.anthropic.comStall signature
From
Claude VSCode.log(extension log on vscode-server, UTC):Two stalls in the same turn, 74.5 s and 36.2 s, matching the gap profile in the OP.
CLI continues, GUI does not
Session JSONL on disk (
~/.claude/projects/.../<session-uuid>.jsonl) has the full ~5.6 KB final assistant text written atT13:28:54Z. CLIclaude --resume <sessionId>opens the same session and renders it fully. VS Code webview shows the chat truncated right after the user prompt; noUnhandled casetoast was visible to the user, but the rendering pipeline behaved exactly as #58984 describes: backend kept producing, panel did not update.Reload Window does NOT recover the response
This is the divergence from #58984 ("reloading re-renders the full conversation from disk"). On this session,
Developer: Reload Windowre-spawnedclaude --resume(logged twice atT13:30:19ZandT13:31:12Z) but the truncated render persisted across both reloads. The chat in GUI still ends at the user prompt; subsequent shorter assistant turns in the same session DO render in GUI.Structural observation in the session JSONL: the assistant entry that fails to render has
attributionSkill: "<skill-name>"set (because the turn was inside a slash-skill invocation). Subsequent turns outside the skill scope omit this field and render fine. Not proven causal, but the only structural difference between the missing entry and the visible entries in the same session JSONL. Worth checking whether the webview branch that handlesattributionSkill-tagged messages is the missing renderer case (cf. #55863 pattern:extension.jsrecognizes message subtype, enqueues ontoinputStream, webview has no render branch).Adjacent hook validation failure (probably unrelated, mentioning for completeness)
Stop hook returning
hookSpecificOutput.additionalContextgot rejected by schema at the exact second the missing assistant turn completed:The hook write was a no-op (Stop hook output is informational only), so this is unlikely to be the render trigger, but the timing collision is interesting if the same code path that surfaces hook output to the webview also dispatches the assistant render event.
Workaround
For long-running, multi-tool-call turns that historically hit stalls (e.g. ticket-triage skills with 10+ Read/Bash/Grep calls and 4-6 KB final output), CLI is the reliable surface; GUI loses the final assistant text whenever a stall lands in the wrong place. The Windows + corporate proxy network path makes stalls more frequent than the macOS profile in the OP (39 separate
Streaming stall detectedevents in one workday, peak gap 131.5 s).Happy to attach the full JSONL + extension log for the affected session privately if useful.
atrwallace commentedon May 14, 2026
Same issue on Windows 11, VS Code 1.119.1 (rolled back from 1.120, same bug), extension 2.1.141, Opus 4.7. Stream stalls + Unhandled case toast.
claude commentedon May 15, 2026
This is a duplicate of #58897, which was fixed as of version 2.1.142.
github-actions commentedon Jul 4, 2026
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.