[BUG] [platform:windows] git-bash -> bash: /c: Is a directory Exit 126

Status Fixed / completed
Maintainer reply None cached
Activity 9 comments · opened Jul 15, 2025 · closed Jul 21, 2025

Environment

  • Claude CLI version: 1.0.51 (Claude Code)
  • Operating System: Windows 11
  • Terminal: Windows-Terminal Version: 1.22.11141.0

Bug Description

Claude Code's Bash tool generates malformed commands on Windows by mixing Unix and Windows command syntax. When
Claude attempts to execute bash commands, it incorrectly constructs commands with Windows CMD syntax (/c CALL)
in a bash context, causing execution failures.

## Steps to Reproduce

  1. Run Claude Code in Windows Terminal with PowerShell 7 and Git Bash available
  2. Have Claude execute any bash command using the Bash tool
  3. Claude internally generates: /usr/bin/bash --login -i /c CALL <path.to.node.exe>
  4. Command fails with error: bash: /c: Is a directory Exit 126

## Expected Behavior
Claude Code should generate proper bash commands for Windows environments, such as:

  • bash --login -i -c "command" (for Git Bash)
  • Or use appropriate Windows command syntax if targeting CMD

## Actual Behavior
Claude Code generates hybrid commands mixing Unix bash invocation (/usr/bin/bash) with Windows CMD flags (/c
CALL
), resulting in syntax errors and command execution failures.

## Additional Context

  • This occurs when Claude uses the Bash tool internally
  • The /c flag is valid for Windows CMD but not for bash
  • The CALL command is Windows batch syntax, not bash
  • Git Bash is installed and functional when used directly

View original on GitHub ↗

9 Comments

fatihaziz · 1 year ago

i got same error!

<img width="302" height="62" alt="Image" src="https://github.com/user-attachments/assets/251994b5-d8ea-4656-95d6-cacad3b97daf" />

<img width="312" height="53" alt="Image" src="https://github.com/user-attachments/assets/c37cc6d9-d5a2-4885-b7e1-ff0dd6e688b1" />

so, did we find why it causing error?

misium · 1 year ago

Looks like @oryon-dominik nailed the issue.

Workaround

Create or edit your ~/.bashrc file to alias the script and run it directly in node.

For example, just like @fatihaziz, I ran into this issue with pnpm. By default, pnpm's $PATH points to a bash and/or .cmd script (this is what which pnpm will point to). We have to bypass those scripts because it looks like CC calls them incorrectly. We'll alias pnpm to run directly via node instead.

Mine looked like:

```.bashrc
alias pnpm='node /c/Users/<User>/AppData/Roaming/npm/node_modules/pnpm/bin/pnpm.cjs'

where `<User>` is your Windows username.
oryon-dominik · 1 year ago

✅ Fixed.

Updated the CLAUDE_CODE_GIT_BASH_PATH from
<USERPROFILE>\scoop\shims\git-bash.exe
to
<USERPROFILE>\scoop\apps\git\current\bin\bash.exe

Works as expected now. Closing.

Mtartup · 1 year ago

how can I update it? I can't find where that setting is

oryon-dominik · 1 year ago

@Mtartup find your preferred bash.exe on your system and set an environment variable CLAUDE_CODE_GIT_BASH_PATH to match that path.

misium · 1 year ago

Unfortunately that didn't fix it for me

ogola89 · 1 year ago
Unfortunately that didn't fix it for me

Same here. It's not working. My install location is C:\Users\<user>\AppData\Local\Programs\Git\bin\bash.exe

gmx1992 · 1 year ago

I fixed it,uninstall your Git, and install it on the C drive.

github-actions[bot] · 1 year ago

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.