claude-code - 💡(How to fix) Fix [BUG] Webview shows literal "Unhandled case: [object Object]" when streaming response ends with had_error=true

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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. 23:15:19.597 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15003 bytesTotal=656 idleDeadlineMs=300000 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 23:17:17.230 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15007 bytesTotal=704 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

23:15:19.597 [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15003 bytesTotal=656 idleDeadlineMs=300000 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

Code Example

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.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. 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].
  2. Send a prompt that causes the model to produce extended thinking before visible output.
  3. Observe the stream begin (Stream started - received first chunk), then go idle for 15–30s intervals (stream_idle_partial warnings in the output log).
  4. Eventually the SDK ends the stream with sdk_stream_ended_no_result {"had_error": true}.
  5. 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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Webview shows literal "Unhandled case: [object Object]" when streaming response ends with had_error=true