Webview toast `Unhandled case: [object Object]` from QB1() exhaustiveness throw (v2.1.141)

Resolved 💬 2 comments Opened May 14, 2026 by Getflowlytics Closed May 15, 2026

Environment

  • Extension: anthropic.claude-code v2.1.141 (published 2026-05-13, latest at time of report)
  • VS Code on macOS (Darwin arm64)
  • Multiple MCP servers active (Docker MCP, analytics-mcp, cloud-run, cloudflare-docs, filesystem2, github, ios-simulator, lean-ctx, magic, playwright, sentry)

Symptom

An in-IDE notification toast appears with:

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

The session continues to function — the toast appears to be cosmetic. It has fired intermittently during normal multi-turn Claude Code use.

Root cause (from extension source inspection)

The throw site is in webview/index.js:

function QB1($, Z) {
  throw Error(Z ?? `Unhandled case: ${$}`)
}

QB1 is an exhaustiveness assertion called from somewhere in the webview. The caller is passing an object as $ but no override message Z, so the template literal renders [object Object] instead of the discriminant key.

This is most likely the symptom of a separate underlying bug: the webview is receiving an event / message type from the agent SDK that this version's switch statement does not have a branch for. QB1 is doing its job (it caught the unhandled case), but the error message hides the actual case identifier — making the report unactionable for downstream users.

Suggested fix

Part 1 — make QB1 self-diagnostic so future occurrences are reportable:

function QB1($, Z) {
  throw Error(
    Z ?? `Unhandled case: ${typeof $ === 'object' ? JSON.stringify($) : String($)}`
  )
}

Part 2 — identify the upstream caller by searching the webview bundle for invocations of QB1 inside switch defaults or discriminated-union narrowing. The actual fix is adding the missing case branch (or a graceful fallback) at the upstream call site.

Repro

Not yet isolated. Reproduced intermittently during multi-turn conversations with tool use across multiple MCP servers. Happy to capture a Developer Tools console snapshot the next time it fires if it would help.

Severity

Cosmetic — does not block functionality, but the error message is uninformative, so users cannot file actionable reports without inspecting bundled source. The Part 1 fix above is a 2-line change with no behavioral impact other than improving diagnosability.

View original on GitHub ↗

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