[BUG] Bash commands sometimes ends with Error: No such file or directory
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.58
- Operating System: Windows 11
- Terminal: Warp - Git Bash
Bug Description
<img width="645" height="461" alt="Image" src="https://github.com/user-attachments/assets/8fd55242-dc65-41e2-a2d9-74735f0b884a" />
The first few commands with pnpm runs correct, but then suddenly it doesn't. I am not sure what is going here.
There are other pnpm commands that doesn't work.
Steps to Reproduce
Honestly not sure. This might be a dumb issue that only I encounter...
Expected Behavior
That every command with pnpm runs correctly.
Actual Behavior
It ends up with a Error: /c/Program: Files\Git\usr\bin\bash.exe: No such file or directory
Additional Context
I am running my git bash in an e/Github/project folder
I followed this:
https://docs.anthropic.com/en/docs/claude-code/setup
First i ran this command to make sure i had the folder structure for my bash:where bash:
It showed this folder:C:\Program Files\Git\usr\bin\bash.exe
So i just changed the guides path to my, so my command was this:
$env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\usr\bin\bash.exe"
34 Comments
I get the same thing aswell.
Same here
! pnpm build
⎿ /usr/bin/bash: Files\git\bin\bash.exe: No such file or directory
I have the same environment as above,
windows 11,warpand same error as your question.I have set the CLAUDE_CODE_GIT_BASH_PATH environment variable, but I still get the same problem.
I also have a variation of this problem:
Environment
This happens when running Claude in the VS Code extension, in a Powershell or in Git bash.
What Claude says to see from the bash
Problem
Runing pnpm commands fails with error:
/usr/bin/bash: Files\Git\bin\bash.exe: No such file or directory.Somehow the SHELL path gets corrupted.
pnpm run test:coverage("test:coverage": "vitest run --coverage")npx vitest run --coverageAttempted Solutions
Yes, this has been plaguing me as well. It seems like claude is trying to use its git bash environment variable _from within git bash_, which of course doesn't work because it isn't using the unix style path. Manually testing this theory shows the same type of error:
<img width="398" height="47" alt="Image" src="https://github.com/user-attachments/assets/c10a8994-c94a-4af1-b0fe-cc3435ebc14a" />
I think that this may also be causing a bug I just reported here: https://github.com/anthropics/claude-code/issues/4382
I am also able to repeat the problem reliably with a simple prompt:
● Bash(pwd)
⎿ Error: /usr/bin/bash: line 1: C:Program: command not found
● Bash(cd)
⎿ Error: /usr/bin/bash: line 1: C:Program: command not found
I have two environment variables set:
CLAUDE_CODE_GIT_BASH_PATH C:\Program Files\Git\bin\bash.exe
CLAUDE_CODE_SHELL_PREFIX C:\Program Files\Git\bin\bash.exe
Yeah, I get the same errors aswell @nickamckenna:
Currently there is a conflict between
CLAUDE_CODE_GIT_BASH_PATHandCLAUDE_CODE_SHELL_PREFIXthat results in this behavior (trying to use the SHELL_PREFIX path from inside the GIT_BASH_PATH executable). As a workaround, you may need to stop specifyingCLAUDE_CODE_SHELL_PREFIXfor now - we're working on a longer term fix here.@ant-kurt,
Even though I removed
CLAUDE_CODE_SHELL_PREFIXand only havingCLAUDE_CODE_GIT_BASH_PATH- I still get the same error.<img width="392" height="158" alt="Image" src="https://github.com/user-attachments/assets/1b1b5d16-3083-4eb3-bd98-a46db394baff" />
I got the same variable in System Variables aswell.
Also, when I restart the terminal to get the
CLAUDE_CODE_SHELL_PREFIXvariable to be zeroed, now I get this error:I'm not even using
CLAUDE_CODE_SHELL_PREFIX.same problem here
I found a workaround.
Problematic config:
Workaround:
@PCJones Looks like your problem was more about the note here: https://docs.anthropic.com/en/docs/claude-code/mcp#configure-mcp-servers
<img width="1508" height="610" alt="Image" src="https://github.com/user-attachments/assets/afca750e-4895-485a-a137-786ecde2f719" />
No, it was the error described in this issue. I just used this npx command as example, this also fixes it for non-npx commands.
don't know if this is related, but when running pnpm commands it opens a new powershell windows for me and then ignores that terminal
This is still happening even with both combinations of ENV variables, does anyone know the fix??
Not a fix of this problem per se, but this bug led me to run Claude Code inside WSL2 instead, which works just fine. Might be a valid alternative if your environment allows it.
I would do that but working on a mobile app with flutter and everything works fine within android studio/windows. This is making me reach my limit so much quicker cause it keeps trying so I'm assuming that's another api call each time it screws up :(
Seeing the same issue on both Windows 10 and 11.
Same issue here, bash commands have nto worked for me for few days already. I hope it get prioritized, going back to WSL after it worked in native windows is not a cool option.
Still occuring with pnpm.
no one has a fix? this is burning through tokens...claude tries multiple times to call the same tool
We have a fix incoming - I'll share here when that's shipped.
IDK if it is shipped yet but with the latest update, I am still getting the error. If you know that already, you can get it as a reminder. Thank you!
Been having this issue too for a few days on Windows 11 - Today I managed to get it resolved within a claude code conversation.
After running the command
npm config set script-shell "/usr/bin/bash"all pnpm commands now work for me within CCI've managed to make it work like this:
This should be resolved in 1.0.68 - we made some improvements to how we spawn sub-processes.
Just updated to 1.0.68 and still running into this. npm works fine but pnpm still hits the same error.
@BumpyClock what shell are you running in? Can you provide the version string, path, and config install method from
/doctor(feel free to redact path details)What env vars are present on your env -
SHELL,COMSPEC,CLAUDE_CODE_SHELL_PREFIX?I am using Git Bash. Here's the variables CC gives me
SHELL=/usr/bin/bash
POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Pro
POSH_SHELL=pwsh
CLAUDECODE=1
POSH_SHELL_VERSION=7.5.2
COMSPEC=C:\Program Files\Git\bin\bash.exe
CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe
CLAUDE_CODE_ENTRYPOINT=cli
FNM_MULTISHELL_PATH=C:\Users\adity\AppData\Local\fnm_multishells\29792_1754229713223
<img width="1235" height="1138" alt="Image" src="https://github.com/user-attachments/assets/41345e99-137a-4f04-8c71-4c53a5742b41" />
Claude doctor output
npm lint runs fine but pnpm doesn't.
Honestly I am not sure this is a bug could very likely be something I am doing wrong.
Actually nvm, user error. Claude update wasn't updating the native install from .67 to .7 for some reason. Running
irm https://claude.ai/install.ps1 | iexagain actually updated to .7 and everything works.Sorry about the noise.
@BumpyClock thanks for following up, and glad that worked for you! Can you provide more details about the native installer update issues - was it failing with some error message, was auto-update not running, etc?
I was on .67 and running Claude update would say it updated but then running Claude doctor would show .67 again. There were no other errors.
Reinstall fixed it.
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.