[BUG] AskUserQuestion permission stream closes before response - "Unhandled case: [object Object]" in VS Code extension
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?
When Claude Code invokes the AskUserQuestion tool, the permission stream closes before a response is received. This causes a JSON parse error (Expected ']') due to malformed tool input JSON, which then surfaces as Unhandled case: [object Object] in the VS Code extension UI. The session becomes unresponsive and shows a stream stall before dying.
What Should Happen?
The AskUserQuestion tool permission prompt should render in the VS Code extension, wait for user input, and return a valid response to the stream without closing prematurely.
Error Messages/Logs
[ERROR] "SyntaxError: SyntaxError: JSON Parse error: Expected ']'
at <parse> (:0)
at parse (unknown)
at jOK (B:/~BUN/root/src/entrypoints/cli.js:175:10088)"
[DEBUG] "AskUserQuestion tool input error: AskUserQuestion failed due to the following issue:
The required parameter `questions` is missing"
[WARN] Streaming completed with 1 stall(s), total stall time: 54.7s
Tool output:
Tool permission request failed: Error: Tool permission stream closed before response received
Steps to Reproduce
- Open Claude Code in VS Code
- Start a session with a sufficiently complex or multi-step task
- Wait for Claude Code to invoke the AskUserQuestion tool (typically happens when it needs clarification mid-task)
- Observe that the permission prompt does not appear in the extension UI
- Stream stalls (~15-30s) then closes with "Tool permission stream closed before response received"
- Extension displays "Unhandled case: [object Object]" in the chat UI
Note: Issue appears intermittent and more likely to occur in longer sessions or after previous stalls.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.92 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Issue occurs intermittently, more frequently in longer sessions. Stream stall warnings appear in logs before the crash (stream_idle_partial with lastChunkAgeMs=15000+). Session had message_count=420 in one instance. OS: Windows (Bun runtime path B:/~BUN/ visible in stack trace).
3 Comments
Seeing the same
Unhandled case: [object Object]banner on macOS (Claude Code v2.1.141, VS Code 1.95+, Darwin 25.4.0), but with a different root cause in the webview console — not AskUserQuestion / JSON parse, but Monaco editor worker loading.Worth noting because both stacktraces end at the same React error boundary, so it might be one bug or two — wanted to flag it in case it's useful triage data.
Webview DevTools console (Cmd+Shift+P → "Developer: Open Webview Developer Tools")
Preceded by 6× CSP font-src violations, then:
Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes.
You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker
Uncaught Error: Cannot read properties of undefined (reading 'toUrl')
TypeError: Cannot read properties of undefined (reading 'toUrl')
at Cv.toUri (index.js:22:12569)
at Cv.asBrowserUri (index.js:22:12022)
at index.js:36:30407
at new Promise (<anonymous>)
at $M.$loadForeignModule (index.js:36:30269)
at index.js:631:7606
at async index.js:1419:6748
This loops hundreds of times until the React error boundary catches it and renders
Unhandled case: [object Object]in the chat UI.Output channel (Anthropic.claude-code.Claude VSCode.log)
The Node side is clean — only routine
claude-vscode: tools/list failed (MCP error -32601: Method not found)per prompt, no AskUserQuestion errors, no JSON parse errors. So this is purely webview-side.Repro
Intermittent, no clear trigger — appears mid-session on long-running tasks. Functionality continues to work (Claude responses still render), banner is cosmetic but persistent until window reload.
Suggested fix direction
Monaco's worker setup needs
MonacoEnvironment.getWorkerdefined for the webview's CSP/sandbox context — the current bundle seems to assume a different host environment. Same place could also tighten the error boundary so unknown error shapes render something less opaque than[object Object].Happy to provide more logs or test a fix.
Wenn du's posten willst:
gh issue comment 59024 --repo anthropics/claude-code --body-file <PATH>
Soll ich den Text in eine .md-Datei im Repo legen damit du ihn easy posten kannst, oder einfacher: du kopierst direkt von hier rein? Letzteres ist sauberer (kein commit-tauglicher Müll im Repo).
aber claude unterbricht dann die session, wird interrupted, jfi
Wichtige Korrektur — dann ist's kein kosmetisches Problem sondern hard breakage. Let me fix the comment:
Seeing the same
Unhandled case: [object Object]banner on macOS (Claude Code v2.1.141, VS Code 1.95+, Darwin 25.4.0), but with a different root cause in the webview console — not AskUserQuestion / JSON parse, but Monaco editor worker loading.Worth noting because both stacktraces end at the same React error boundary, so it might be one bug or two — wanted to flag it in case it's useful triage data.
Impact
Not just cosmetic — when the banner appears, the active Claude session is interrupted. The stream stops mid-response and the user has to restart or resume. Functionality is not preserved across the error.
Webview DevTools console (Cmd+Shift+P → "Developer: Open Webview Developer Tools")
Preceded by 6× CSP font-src violations, then:
Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes.
You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker
Uncaught Error: Cannot read properties of undefined (reading 'toUrl')
TypeError: Cannot read properties of undefined (reading 'toUrl')
at Cv.toUri (index.js:22:12569)
at Cv.asBrowserUri (index.js:22:12022)
at index.js:36:30407
at new Promise (<anonymous>)
at $M.$loadForeignModule (index.js:36:30269)
at index.js:631:7606
at async index.js:1419:6748
This loops hundreds of times until the React error boundary catches it and renders
Unhandled case: [object Object]in the chat UI, interrupting the in-flight session.Output channel (Anthropic.claude-code.Claude VSCode.log)
The Node side is clean — only routine
claude-vscode: tools/list failed (MCP error -32601: Method not found)per prompt, no AskUserQuestion errors, no JSON parse errors. So this is purely webview-side.Repro
Intermittent, no clear trigger — appears mid-session on long-running tasks. After the banner, the session is dead and the next prompt starts a fresh stream context.
Suggested fix direction
Monaco's worker setup needs
MonacoEnvironment.getWorkerdefined for the webview's CSP/sandbox context — the current bundle seems to assume a different host environment. Same place could also tighten the error boundary so unknown error shapes render something less opaque than[object Object]instead of killing the session.Happy to provide more logs or test a fix.
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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.