[BUG] Windows: file existence check uses cmd.exe dir instead of fs.existsSync, fails when cmd.exe is blocked by corporate policy

Resolved 💬 3 comments Opened Apr 8, 2026 by rfatkocak Closed Apr 17, 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?

Claude Code fails to start on Windows when cmd.exe is blocked by corporate Group Policy (GPO). The file existence check function uses execSync('dir "path"') which internally invokes cmd.exe. When cmd.exe is restricted, this check fails even though bash.exe exists and is fully accessible. This affects both the terminal CLI and the VS Code extension, making Claude Code completely unusable.

What Should Happen?

Claude Code should start normally since bash.exe exists at the specified path and is accessible by Node.js. The file existence check should use fs.accessSync() or fs.existsSync() instead of cmd.exe-dependent dir command.

Error Messages/Logs

Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "C:\Program Files\Git\bin\bash.exe"

VS Code Extension log:
2026-04-08 12:28:26.052 [info] From claude: Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "C:\Program Files\Git\bin\bash.exe"
2026-04-08 12:28:26.077 [error] Error spawning Claude (on channel x0zbuqiuib): Error: Query closed before response received
Proof that the file exists and is accessible:
PS> & "C:\Program Files\Git\bin\bash.exe" --version
GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)

PS> node -e "const fs = require('fs'); try { fs.accessSync('C:\\Program Files\\Git\\bin\\bash.exe', fs.constants.R_OK | fs.constants.X_OK); console.log('OK'); } catch(e) { console.log('FAIL:', e.message); }"
OK
Root cause in cli.js - function f28() uses dir command:
javascriptfunction f28(q){
  try{ return Sf6(`dir "${q}"`,{stdio:"pipe"}),!0 }
  catch{ return!1 }
}
Suggested fix:
javascriptconst fs = require('fs');
function f28(q){
  try{ fs.accessSync(q, fs.constants.R_OK); return true }
  catch{ return false }
}

Steps to Reproduce

Use a Windows machine where cmd.exe is blocked by corporate Group Policy
Install Git for Windows at default location (C:\Program Files\Git)
Set environment variable: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe
Run claude from PowerShell or Git Bash
Claude Code exits with "unable to find CLAUDE_CODE_GIT_BASH_PATH path" error
Same result occurs when using VS Code extension

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.96 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

This issue makes Claude Code completely unusable in corporate Windows environments where cmd.exe is restricted — which is a very common enterprise security policy. The fix is trivial (fs.accessSync instead of execSync('dir ...')) and would unblock corporate users. There is currently no workaround unless WSL is available on the machine. Node.js version: v24.12.0.

View original on GitHub ↗

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