[BUG] Webview shows literal "Unhandled case: [object Object]" when streaming response ends with had_error=true
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The Claude Code VS Code extension renders a red banner with the literal text "Unhandled case: [object Object]" when a streaming response terminates abnormally.
This happens when the SDK stream ends with had_error: true and no final result block after one or more stream_idle_partial stalls. The error object is reaching the webview's renderer, but no case in the rendering switch handles its shape — the default branch coerces the object to a string, producing "[object Object]".
The user is left with no actionable information: no error code, no retry hint, no indication that the response was cut off mid-stream. The "View output logs" link is the only way to discover what actually happened.
This is a UI rendering bug — even if the underlying stream stall is a separate networking concern, the webview should never display "[object Object]" to a user.
Extension version: anthropic.claude-code 2.1.141 (win32-x64)
Model: claude-opus-4-7[1m]
Thinking level: default_on
Conversation: long resumed session (message_count: 162+)
Webview banner shown to user:
Unhandled case: [object Object]
View output logs · Troubleshooting resources
Relevant output log entries (Anthropic.claude-code.Claude VSCode.log):
23:15:02.068 [DEBUG] [API REQUEST] /v1/messages source=sdk
23:15:04.594 [DEBUG] Stream started - received first chunk
23:15:19.597 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15003 bytesTotal=656 idleDeadlineMs=300000
23:15:34.625 [info] sdk_stream_ended_no_result {"had_error":true,"subagent_count":0,"message_count":162}
23:15:47.638 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15005 bytesTotal=692
23:16:02.643 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=30009 bytesTotal=692
23:16:26.413 [WARN] Streaming stall detected: 81.8s gap between events (stall #1)
23:16:49.535 [WARN] Streaming completed with 1 stall(s), total stall time: 81.8s
Retrying via "Continue please" reproduces the same chain:
23:17:04.224 sdk_stream_ended_no_result {"had_error":true,"subagent_count":0,"message_count":165}
23:17:17.230 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15007 bytesTotal=704
The "[object Object]" banner appears immediately after each sdk_stream_ended_no_result with had_error=true.
What Should Happen?
When the stream ends with had_error=true, the webview should display a human-readable error message — ideally with the error kind, a brief explanation ("Response was interrupted before completion"), and a retry affordance.
At minimum, the default branch in the error-rendering switch should JSON.stringify the unknown envelope so users can see what actually went wrong instead of "[object Object]".
Error Messages/Logs
From Anthropic.claude-code.Claude VSCode.log:
23:15:02.068 [DEBUG] [API REQUEST] /v1/messages source=sdk
23:15:04.594 [DEBUG] Stream started - received first chunk
23:15:19.597 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15003 bytesTotal=656 idleDeadlineMs=300000
23:15:34.625 [info] sdk_stream_ended_no_result {"had_error":true,"subagent_count":0,"message_count":162}
23:15:47.638 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15005 bytesTotal=692
23:16:02.643 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=30009 bytesTotal=692
23:16:26.413 [WARN] Streaming stall detected: 81.8s gap between events (stall #1)
23:16:49.535 [WARN] Streaming completed with 1 stall(s), total stall time: 81.8s
→ Webview renders red banner: "Unhandled case: [object Object]"
Retrying via "Continue please" reproduces the same chain with message_count: 165.
Steps to Reproduce
- Open a long-running resumed session in the Claude Code VS Code extension (message_count >150 in my case) with thinkingLevel=default_on and model claude-opus-4-7[1m].
- Send a prompt that causes the model to produce extended thinking before visible output.
- Observe the stream begin (
Stream started - received first chunk), then go idle for 15–30s intervals (stream_idle_partialwarnings in the output log). - Eventually the SDK ends the stream with
sdk_stream_ended_no_result {"had_error": true}. - Red banner appears in the webview: "Unhandled case: [object Object]".
The stream stall is not 100% deterministic (it depends on network conditions and how long the thinking phase runs), but the rendering bug is 100% deterministic once the had_error envelope reaches the webview.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.141 (Claude Code — VS Code extension, anthropic.claude-code-2.1.141-win32-x64)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
standalone CLI was 2.1.72 at time of filing but was unrelated to the bug (the extension uses its own bundled binary).
- OS: Windows 11 Pro 10.0.26200
- VS Code:
- Extension: anthropic.claude-code 2.1.141 (win32-x64)
- Claude CLI: 2.1.141 (from log header
cc_version=2.1.141.af1) - Model: claude-opus-4-7[1m]
- Permission mode: acceptEdits
- Thinking level: default_on
VSCode:
Version: 1.120.0 (user setup)
Commit: 0958016b2af9f09bb4257e0df4a95e2f90590f9f
Date: 2026-05-12T20:17:22Z
Electron: 39.8.8
ElectronBuildId: 13870025
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗