[BUG] Bash tool returns exit code 5 on native Windows in Parallels VM
Bug Description
The Bash tool consistently returns exit code 5 (Windows ERROR_ACCESS_DENIED) for all commands on native Windows running inside a Parallels Desktop VM. No output is produced and no commands execute. All other tools (Read, Write, Edit, Glob, Grep) work correctly.
Environment
- OS: Windows (native, not WSL) running inside Parallels Desktop on macOS
- Claude Code Version: 2.1.33 (also reproduced on 2.1.31)
- Installation Methods Tested: npm-global and native installer
- Node.js: Installed and functional
- Git for Windows: Installed at C:\Program Files\Git\bin\bash.exe
- PowerShell Execution Policy: RemoteSigned (CurrentUser scope)
- WSL2: Cannot be installed (nested virtualization not supported in Parallels)
Steps to Reproduce
- Set up a Windows VM in Parallels Desktop on macOS
- Install Claude Code (npm or native installer)
- Install Git for Windows
- Set CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe
- Run Claude Code (VS Code extension or CLI)
- Attempt any Bash tool command (e.g., whoami, dir, echo hello)
- All commands return exit code 5 with no output
Expected Behavior
Bash commands should execute and return output.
Actual Behavior
All Bash tool commands immediately return exit code 5 with no output, regardless of the command.
Troubleshooting Already Attempted
- [x] Verified Git Bash exists at expected path (Test-Path returns True)
- [x] Set CLAUDE_CODE_GIT_BASH_PATH environment variable (both session and persistent User scope)
- [x] Tried PowerShell as shell
- [x] Tried cmd.exe as shell
- [x] Tried dangerouslyDisableSandbox: true on Bash tool calls - same result
- [x] Verified Node.js child_process.execSync('whoami') works perfectly (returns username)
- [x] Checked Windows Exploit Protection settings - no policies targeting VS Code, Node.js, or Git
- [x] Checked Parallels security settings - Isolate Windows from Mac is disabled
- [x] PowerShell execution policy is RemoteSigned (not Restricted)
- [x] Upgraded from 2.1.31 to 2.1.33 (both npm and native installer)
- [x] Fully restarted VS Code multiple times
- [x] Reproduced in both VS Code extension and CLI
- [x] Ran claude doctor - all checks passed (Search: OK, auto-updates: enabled)
- [x] WSL2 installation fails due to no nested virtualization support in Parallels
Key Diagnostic Finding
Node.js child_process.execSync('whoami') executes successfully and returns the correct username. This confirms the OS is NOT blocking child process spawning from Node.js. The issue is specific to how Claude Code's Bash tool spawns processes.
claude doctor Output
Diagnostics
Currently running: npm-global (2.1.31)
Path: C:\Program Files\nodejs\node.exe
Search: OK (vendor)
Updates
Auto-updates: enabled
Update permissions: Yes
Auto-update channel: latest
Additional Context
Exit code 5 is undocumented in Claude Code. On Windows, exit code 5 corresponds to ERROR_ACCESS_DENIED. Since native Windows sandbox support is listed as planned in the official docs, this may be related to the sandbox infrastructure attempting operations that are unsupported or blocked in a Parallels virtualization context.
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This appears to be the same root cause as my issue. Claude Code is attempting HCS/Hyper-V sandbox VM creation for bash execution on native Windows, even though native Windows sandbox support is not yet implemented.
In my case, I'm running native Windows inside a Parallels Desktop VM on macOS. Parallels does not support nested virtualization, so Hyper-V/HCS is completely unavailable. Every Bash tool call fails with exit code 5 (ERROR_ACCESS_DENIED) - no commands execute and no output is produced.
Key diagnostic:
node -e "console.log(require('child_process').execSync('whoami').toString())"works perfectly, confirming Node.js child_process spawning is fine. The issue is specifically in Claude Code's sandbox wrapper attempting HCS operations that the system cannot perform.Setting
dangerouslyDisableSandbox: truedoes not help - the HCS path still appears to be invoked.WSL2 is also not an option since it requires Hyper-V, which again requires nested virtualization.
Related issue: #23564
Resolution Found
Enabling nested virtualization in Parallels Desktop resolves this issue.
Steps: Shut down the VM > Parallels Configuration > Hardware > CPU & Memory > Advanced > Enable nested virtualization. Reference: https://kb.parallels.com/116239/
Root Cause: Claude Code uses HCS (Hyper-V Host Compute Service) to sandbox bash execution on native Windows. Inside a Parallels VM, HCS is unavailable unless nested virtualization is explicitly enabled. Without it, every Bash tool call fails with exit code 5 (ERROR_ACCESS_DENIED) because the HCS sandbox VM cannot be created.
This is the same underlying mechanism described in #23170 - Claude Code attempts HCS sandbox creation for bash execution on native Windows, and when HCS is unavailable or restricted, commands fail silently with an unhelpful exit code.
Suggestion for the Claude Code team: When HCS sandbox creation fails on native Windows, the error should be surfaced clearly (e.g., "HCS sandbox unavailable - ensure Hyper-V is enabled") rather than returning a generic exit code 5. Additionally, a fallback to direct Git Bash execution without HCS sandboxing would allow Claude Code to function on Windows environments where Hyper-V/HCS is not available.
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.