VSCode Extension: Process crashes with exit code 1 when denying tool permission in plan mode

Resolved 💬 2 comments Opened Jan 13, 2026 by ragnos-dev Closed Feb 27, 2026

Description

When using the Claude Code VSCode extension and denying a tool permission while in plan mode (selecting "stay in plan mode and continue planning"), the Claude Code process crashes with exit code 1 due to a race condition between permission denial and active stream cleanup.

Steps to Reproduce

  1. Start a conversation in plan mode
  2. Have Claude attempt to use a tool (e.g., Bash)
  3. Select "stay in plan mode and continue planning" to deny the tool permission
  4. Process crashes

Expected Behavior

The process should gracefully handle the permission denial and continue the planning session without crashing.

Actual Behavior

The process crashes with exit code 1. The extension then restarts and continues working, but session state may be lost.

Log Excerpt

2026-01-13 08:33:05.246 [info] Received message from webview: {"type":"response","requestId":"253e80cda765d05f00f7c4072cfb818a","response":{"type":"tool_permission_response","result":{"behavior":"deny","message":"User chose to stay in plan mode and continue planning","interrupt":true}}}

2026-01-13 08:33:06.122 [info] From claude: 2026-01-13T13:33:06.118Z [DEBUG] Getting matching hook commands for SessionEnd with query: other

2026-01-13 08:33:06.142 [info] From claude: 2026-01-13T13:33:06.138Z [DEBUG] MCP server "playwright": Sending SIGINT to MCP server process
2026-01-13T13:33:06.138Z [DEBUG] MCP server "nanobanana": Sending SIGINT to MCP server process
2026-01-13T13:33:06.138Z [DEBUG] LSP server manager shut down successfully

2026-01-13 08:33:06.159 [info] From claude: 2026-01-13T13:33:06.154Z [DEBUG] Streaming aborted by user: Request was aborted.
2026-01-13T13:33:06.154Z [ERROR] Error in non-streaming fallback: Request was aborted.
2026-01-13T13:33:06.154Z [ERROR] "Error: Error: Request was aborted.\n    at _createMessage (/$bunfs/root/claude:446:3157)\n    at processTicksAndRejections (native:7:39)"

2026-01-13 08:33:07.039 [info] Closing Claude on channel: cs0i97kr1u9
2026-01-13 08:33:07.039 [error] Error from Claude (on channel cs0i97kr1u9): Error: Claude Code process exited with code 1

Analysis

The race condition appears to be:

  1. Tool permission denied with interrupt: true
  2. This triggers SessionEnd cleanup (MCP servers shutting down)
  3. But an API streaming request is still in flight
  4. The cleanup kills the stream, causing Request was aborted error
  5. The unhandled abort crashes the process

Environment

  • Platform: macOS (Darwin 24.6.0)
  • VSCode Extension: Claude Code
  • MCP Servers configured: playwright, nanobanana, desktop-commander

Suggested Fix

The permission denial handler with interrupt: true should wait for or cancel the active stream gracefully before triggering session cleanup, rather than racing with it.

View original on GitHub ↗

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