[BUG] claude silently launches VS Code instead of terminal session when run from subdirectory of trusted project

Resolved 💬 4 comments Opened Mar 30, 2026 by Varelion Closed Mar 31, 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?

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

  1. Install the anthropic.claude-code VS Code extension
  2. Run claude from a project root (e.g. C:\project\) — accept the trust prompt; this creates a

session entry under ~/.claude/projects/

  1. Exit the session (/exit or Ctrl+C)
  2. In the same cmd.exe window, cd into a subdirectory (e.g. C:\project\src\)
  3. 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": false to ~/.claude/settings.json
  • You uninstall the anthropic.claude-code VS 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
  • EDITOR or VISUAL environment variables
  • VS Code AutoRun registry key (HKCU\Software\Microsoft\Command Processor\AutoRun)
  • A local claude binary override in node_modules/.bin/
  • Running from VS Code's integrated terminal

View original on GitHub ↗

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