Webview shows "Unhandled case: [object Object]" when SDK stream ends with had_error: true

Resolved 💬 3 comments Opened May 14, 2026 by ruisebastiao Closed May 15, 2026

Summary

The webview shows a red banner Unhandled case: [object Object] (with links View output logs · Troubleshooting resources) when an SDK streaming response terminates with had_error: true instead of producing a final result. The fallback renders the event object via default string coercion (String(obj)[object Object]), so the failure is opaque to the user.

Environment

  • Extension version: anthropic.claude-code 2.1.141 (win32-x64)
  • VSCode native extension (not the CLI)
  • OS: Windows 11 Pro 26200

Frequency

Recurrent. Happens on long sessions whenever the API stream stalls and the SDK eventually gives up. In a single session I saw 5 stall events; the last one was fatal.

Concrete timeline (session id a8c536d8-89ef-4ccd-a745-467809ff502c)

| Local time | Event |
|---|---|
| 00:22:46.408 | POST /v1/messages sent (x-client-request-id=a9299fc6-22ea-4d8e-85d7-8e893a38c5cf) |
| 00:22:48.656 | Stream started - received first chunk |
| 00:23:03.659 | [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15001 bytesTotal=671 idleDeadlineMs=300000 |
| 00:23:18.678 | Webview emits log_event sdk_stream_ended_no_result {"had_error":true,"subagent_count":0,"message_count":144} |
| 00:23:18.780 | [WARN] Streaming stall detected: 30.1s gap between events (stall #1) |
| 00:23:32 | Channel 0g8uwcq5mzqw closed; LSP server manager shut down |
| 00:23:39.930 | [WARN] Streaming completed with 1 stall(s), total stall time: 30.1s |

Other stream_idle_partial warnings in the same session (these recovered): lines 728, 800, 1969, 2967 of the log (timestamps 00:09:03, 00:09:52, 00:18:17, 00:22:38). Only the last one (at 00:23:03) ended in had_error: true.

Expected behaviour

A user-friendly banner — e.g. "Streaming response interrupted — retry?" — with a retry button.

Actual behaviour

A red banner reading literally Unhandled case: [object Object] with links View output logs · Troubleshooting resources. The object is not serialised, so the actual event payload cannot be inspected without digging into the extension host log.

Suggested fix

  1. Add an explicit handler in the webview renderer for the SDK event emitted when a stream ends with had_error: true (or with sdk_stream_ended_no_result).
  2. In the default/fallback branch, serialise the unknown event with JSON.stringify(obj) (or include event.type) instead of String(obj), so future unhandled cases are at least diagnosable.
  3. Consider auto-retry / resume-from-last-chunk when bytesTotal > 0 and the deadline is hit before idleDeadlineMs — five 15s stalls in one session suggests the streaming endpoint sometimes recovers and sometimes does not.

Possibly related issues seen in the same log (may be independent)

  • [ERROR] MCP server "claude-vscode" Failed to fetch tools: MCP error -32601: Method not found (multiple occurrences)
  • [DEBUG] Grove: Failed to fetch and store config: TypeError: undefined is not an object (evaluating '$.timestamp')
  • [ERROR] rg failed (signal=SIGTERM, code=undefined): ripgrep exited with code null (several occurrences — looks like in-flight ripgrep processes being killed)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗