CLI started in VS Code integrated terminal opens 3 blank VS Code windows (Windows)
Description
When running claude (or claude --dangerously-skip-permissions) from VS Code's integrated terminal (PowerShell) on Windows, 3 blank VS Code windows open every time. This does not happen when running from a standalone terminal (Windows Terminal).
Environment
- OS: Windows 11 Pro 10.0.26200
- VS Code extension:
anthropic.claude-codev2.1.69 - CLI:
@anthropic-ai/claude-codev2.1.69 (global npm install) - VS Code setting:
claudeCode.preferredLocation: "panel"
Steps to Reproduce
- Open VS Code with the Claude Code extension installed
- Open the integrated terminal (PowerShell)
- Type
claudeand press Enter - 3 blank VS Code windows appear immediately
Root Cause (from log analysis)
When the CLI starts inside VS Code's integrated terminal, it connects to the extension's WebSocket MCP server. This triggers a burst of ~62 rapid WebSocket connections (visible in the extension log), each displacing the previous one:
Extension log (window1/exthost/Anthropic.claude-code/Claude VSCode.log):
2026-03-05 06:52:37.757 [info] New WS connection from: /
2026-03-05 06:52:37.757 [info] Disconnecting previous WebSocket client
2026-03-05 06:52:37.757 [info] MCP server connected to transport
2026-03-05 06:52:37.760 [info] New WS connection from: /
2026-03-05 06:52:37.760 [info] Disconnecting previous WebSocket client
2026-03-05 06:52:37.760 [info] MCP server connected to transport
2026-03-05 06:52:37.763 [info] New WS connection from: /
... (62 connections total within ~8 seconds)
This cascade results in 3 new blank renderer processes being spawned by the main VS Code process, each activating the Claude extension and starting its own MCP server on a random port:
window31: Claude code extension is now active? — MCP Server running on port 24700
window32: Claude code extension is now active? — MCP Server running on port 50340
window33: Claude code extension is now active? — MCP Server running on port 43636
The renderer log also shows errors during this period:
2026-03-05 06:52:38.272 [error] [Extension Host] Error sending selection change notification: Error: WebSocket is not open. Cannot send message.
Additional Evidence
- VS Code
main.logshows exactly 3updateWindowsJumpListentries at the same timestamps as the blank windows - The pattern repeats consistently — every CLI start creates a new batch of 3 workspace storage directories (with no
workspace.json, confirming they're blank/folderless windows) - Groups of 3 extension hosts exit when the blank windows are closed, then 3 new ones spawn on next CLI start
Workaround
Run claude from a standalone terminal (e.g., Windows Terminal) instead of VS Code's integrated terminal. The blank windows do not appear when the CLI is not running inside VS Code's terminal.
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I've been using the following workaround in the integrated terminal (Powershell) in VS Code:
$env:TERM_PROGRAM=''; $env:VSCODE_INJECTION=''; claude
Should be fixed in
2.1.70.Workaround: Permanent fix for 3 blank VS Code windows on Windows (Git Bash)
Environment:
Root Cause:
VS Code's integrated terminal sets environment variables (
TERM_PROGRAM,VSCODE_INJECTION,CLAUDE_CODE_SSE_PORT) that Claude Code detects and uses to connect to the IDE. Each MCP server initialization reads these variables and triggers a new blank VS Code window.Fix
Create a shell alias that unsets these variables before launching Claude.
Step 1: Create
.bashrcwith the alias:Step 2: Load it in the current session:
Step 3: Make it persistent across all future terminal sessions by creating
.bash_profile:How it works
claudecommand to clear the three environment variables before execution.command claudeensures the alias calls the actualclaudebinary and not itself (avoids infinite recursion)..bash_profileensures.bashrcis sourced on every new Git Bash session, including VS Code's integrated terminal.Result
After applying this fix, typing
claudein any VS Code integrated terminal (Git Bash) works normally with zero blank windows. Works across all repos and projects.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.