[BUG] Running claude code in VS Code integrated terminal spawns 3 blank VS Code windows on Windows

Resolved 💬 3 comments Opened Mar 5, 2026 by ramdacc Closed Mar 6, 2026

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?

Bug Description

Running claude in VS Code's integrated terminal on Windows spawns 3 blank VS Code windows (no folder loaded) every time. The windows appear sequentially, one after the other.

## Environment

  • OS: Windows 11 Pro 10.0.26100
  • Claude Code: 2.1.58
  • VS Code: 1.110.0
  • Shell: PowerShell (integrated terminal)
  • Plugins enabled: frontend-design, context7, vercel

## Root Cause

Claude Code's child processes (MCP servers) inherit VS Code's environment variables — specifically TERM_PROGRAM=vscode and VSCODE_INJECTION=1. These cause the child processes to trigger VS Code's window
management, spawning blank windows.

### Proof

Unsetting the env vars before launch eliminates the issue entirely:

```powershell
$env:TERM_PROGRAM=''; $env:VSCODE_INJECTION=''; claude

No blank windows appear with this workaround.

What was ruled out

  • Disabling all 3 plugins (frontend-design, context7, vercel) — did NOT fix it
  • Clearing VS Code's emptyWindows state in storage.json — did NOT fix it (VS Code recreates them)
  • Deleting orphaned workspaceStorage entries — did NOT fix it
  • Setting window.restoreWindows: "none" and window.openFoldersInNewWindow: "off" — did NOT fix it

Context

This issue started after using 3 concurrent git worktrees via Claude Code's worktree feature. The behavior persists even after all worktrees were removed and git worktree list shows only the main worktree. The number of blank windows (3) has remained constant.

Actual Behavior

3 blank VS Code windows open every time claude is run from the integrated terminal.

What Should Happen?

Claude Code should strip VS Code IPC/terminal environment variables (TERM_PROGRAM, VSCODE_INJECTION, and potentially VSCODE_GIT_ASKPASS_*) from child processes (MCP servers, etc.) to prevent them from
interacting with VS Code's window management.

Error Messages/Logs

None. It's a bug, not an error.

Steps to Reproduce

  1. Open VS Code with any project folder
  2. Open the integrated terminal (PowerShell)
  3. Run claude
  4. Observe 3 blank VS Code windows spawn one after the other

Claude Model

Other

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.58

Claude Code Version

2.1.58

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

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