Skip to content

VS Code extension: "Unhandled case: [object Object]" when the API stream stalls (CLI/TUI mode unaffected) #59067

Closed as duplicate

Description

@Godvvs

Summary

In the VS Code extension, conversations intermittently crash with this UI error:

Unhandled case: [object Object]
View output logs · Troubleshooting resources

On the same machine, the CLI (interactive TUI mode) — same version, same network, same proxy — never hits this. It happens across multiple projects, on both brand-new conversations and long ones.

Environment

  • Claude Code VS Code extension: anthropic.claude-code-2.1.141-darwin-arm64
  • Claude Code CLI: 2.1.141
  • VS Code: 1.120.0
  • OS: macOS (Darwin 25.4.0), Apple Silicon (arm64)
  • Network: API accessed through a local HTTP/SOCKS proxy (http(s)_proxy / all_proxy → 127.0.0.1)

What the logs show

The extension's claude backend logs the API stream stalling, then ending with no result. Two separate occurrences:

Occurrence 1 — brand-new conversation (message_count: 2):

[WARN] [Stall] stream_idle_partial lastChunkAgeMs=15001 bytesTotal=673 idleDeadlineMs=300000
[WARN] Streaming stall detected: 43.0s gap between events (stall #1)
[WARN] Streaming completed with 1 stall(s), total stall time: 43.0s
log_event "sdk_stream_ended_no_result" {"had_error":true,"subagent_count":0,"message_count":2}

Occurrence 2 — long conversation (message_count: 47), right after a built-in sub-agent finished:

[WARN] [Stall] stream_idle_partial lastChunkAgeMs=15000 bytesTotal=654 idleDeadlineMs=300000
log_event "sdk_stream_ended_no_result" {"had_error":true,"subagent_count":0,"message_count":47}
[WARN] Streaming stall detected: 40.2s gap between events (stall #1)
[WARN] Streaming completed with 1 stall(s), total stall time: 40.2s

Notable: on every stall, bytesTotal is tiny and remarkably consistent (654 / 673 / 675 / 705 bytes) — the stream seems to freeze right after headers / the first SSE chunk, with 30–43s gaps between events.

Why the CLI is unaffected (process comparison)

The extension drives the backend in headless stream-json mode; the CLI runs interactive TUI mode:

Command line (abridged)
Extension backend claude --output-format stream-json --input-format stream-json --include-partial-messages --replay-user-messages --debug …
CLI claude --dangerously-skip-permissions

Both processes have identical proxy environment variables. The difference is the run mode — and sdk_stream_ended_no_result is specific to the headless/SDK path; the TUI mode has no such concept.

Likely root cause

  1. Unhandled case: [object Object] — the webview UI receives an error-state object it has no switch/case branch for, and stringifies it.
  2. Upstream: the API stream stalls → the headless stream-json path produces sdk_stream_ended_no_result + had_error: true → that error state reaches the webview UI unhandled.

Network instability (proxy) is a plausible trigger, but the CLI tolerates the exact same network and proxy without crashing, so the gap is in how the extension's headless mode + webview UI handle a stalled / incomplete stream.

Suggested fixes

  • The webview UI should render stream-interruption errors gracefully (e.g. "stream interrupted — retrying / please retry") instead of Unhandled case: [object Object].
  • The headless stream-json path should retry or recover gracefully on stream stall / sdk_stream_ended_no_result, rather than surfacing an unhandled error object to the UI.

Minor, possibly related

On every session start the backend logs, at ERROR level:

[ERROR] MCP server "claude-vscode" Failed to fetch tools: MCP error -32601: Method not found

(tools/list on the built-in claude-vscode MCP server.) It retries once and the session continues, so it appears benign — but it's logged as ERROR on a version-matched extension/CLI pair (2.1.141).

Activity

  1. clhaasie commented on May 14, 2026

    @clhaasie

    Experiencing the exact same issue on Windows 11. Same VS Code version and same Claude Code for VS Code extension version.

  2. sailesh commented on May 14, 2026

    @sailesh

    Experiencing this very frequently on Tahoe 26.4.1 (25E253).
    Anthropic.claude-code 2.1.141
    Claude Code for VS Code

    2026-05-15 00:26:07.690 [info] From claude: 2026-05-14T14:26:07.689Z [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15000 bytesTotal=663 idleDeadlineMs=300000
    2026-05-15 00:36:21.469 [info] From claude: 2026-05-14T14:36:21.469Z [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15000 bytesTotal=734 idleDeadlineMs=300000
    2026-05-15 00:36:45.262 [info] From claude: 2026-05-14T14:36:45.261Z [WARN] [Stall] stream_idle_partial lastChunkAgeMs=15003 bytesTotal=770 idleDeadlineMs=300000

  3. claude commented on May 15, 2026

    @claude
    Contributor

    This is a duplicate of #58897, which was fixed as of version 2.1.142.

  4. github-actions commented on Jul 4, 2026

    @github-actions

    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.

  5. locked as resolved and limited conversation to collaborators on Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api:anthropicarea:idebugSomething isn't workingduplicateThis issue or pull request already existsplatform:macosIssue specifically occurs on macOSplatform:vscodeIssue specifically occurs in VS Code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions