[BUG] claude silently launches VS Code instead of terminal session when run from subdirectory of trusted project
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 running claude from a subdirectory of a previously-visited project, the CLI immediately
exits and silently spawns VS Code instead of starting an interactive terminal session. No error is
shown — the command just returns to the prompt and VS Code opens.
What Should Happen?
Claude Code should start an interactive terminal session, identical to the behavior when running from
the project root directory.
Error Messages/Logs
C:\Users\varelion\test\tstest\src>claude
C:\Users\varelion\test\tstest\src>
[main 2026-03-30T18:49:05.645Z] update#setState idle
[main 2026-03-30T18:49:07.382Z] Extension host with pid 17712 exited with code: 0, signal: unknown.
Steps to Reproduce
- Install the
anthropic.claude-codeVS Code extension - Run
claudefrom a project root (e.g.C:\project\) — accept the trust prompt; this creates a
session entry under ~/.claude/projects/
- Exit the session (
/exitor Ctrl+C) - In the same
cmd.exewindow,cdinto a subdirectory (e.g.C:\project\src\) - Run
claude
Result: CLI exits immediately, VS Code opens, extension host starts and exits.
Note: The bug does NOT reproduce if:
- You run from a brand-new directory with no prior session (trust prompt appears and session starts
normally)
- You use PowerShell instead of cmd.exe
- You add
"ide": falseto~/.claude/settings.json - You uninstall the
anthropic.claude-codeVS Code extension
This suggests the trigger is: subdirectory of trusted/previously-visited project + VS Code extension
installed + cmd.exe shell.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
N/A, it works on other directories and in powershell in the afflicted directory.
Claude Code Version
v2.1.87
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Workaround: Adding "ide": false to ~/.claude/settings.json resolves the issue immediately.
Root cause hypothesis: The CLI detects a session entry in ~/.claude/projects/ for the parent
directory and treats the project as trusted/known. When the anthropic.claude-code VS Code extension
is installed, it then auto-defers to VS Code for new CWDs within that project rather than starting a
terminal session. The behavior differs between cmd.exe and PowerShell likely due to differences in
how node.js detects TTY/stdin characteristics in each shell.
Confirmed NOT caused by:
- %TEMP%
- ~./.claude
- /tstest/.claude
- Hooks in
.claude/settings.local.json EDITORorVISUALenvironment variables- VS Code AutoRun registry key (
HKCU\Software\Microsoft\Command Processor\AutoRun) - A local
claudebinary override innode_modules/.bin/ - Running from VS Code's integrated terminal
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗