[BUG] Bash commands sometimes ends with Error: No such file or directory

Resolved 💬 34 comments Opened Jul 23, 2025 by ALagoni97 Closed Aug 5, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

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"

View original on GitHub ↗

34 Comments

byigitt · 11 months ago

I get the same thing aswell.

> Can you run pnpm --version

● I'll check the pnpm version for you.

● Bash(pnpm --version)
  ⎿  Error: /usr/bin/bash: Files\Git\bin\bash.exe: No such file
     or directory
arthurlongue · 11 months ago

Same here

! pnpm build
⎿  /usr/bin/bash: Files\git\bin\bash.exe: No such file or directory

chsong1 · 11 months ago

I have the same environment as above, windows 11, warp and same error as your question.
I have set the CLAUDE_CODE_GIT_BASH_PATH environment variable, but I still get the same problem.

eikowagenknecht · 11 months ago

I also have a variation of this problem:

Environment

  • Windows 11

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

  • Unix path: /usr/bin/bash
  • Real Windows path: C:\Program Files\Git\usr\bin\bash.exe
  • Bash version: GNU bash 5.2.37(1)-release (x86_64-pc-msys)
  • File type: PE32+ executable (Windows executable)

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.

  • Simple bash commands work: echo "hello", ls, pwd
  • Direct commands work: pnpm --version, node --version
  • Fails: pnpm run test:coverage ("test:coverage": "vitest run --coverage")
  • Fails with: /usr/bin/bash: Files\Git\bin\bash.exe: No such file or directory
  • Works for some reason: npx vitest run --coverage

Attempted Solutions

  • Setting CLAUDE_CODE_GIT_BASH_PATH environment variable - did not help
tskimmett · 11 months ago

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" />

nickamckenna · 11 months ago

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:

Can you execute the command pwd

● 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

byigitt · 11 months ago

Yeah, I get the same errors aswell @nickamckenna:

● Bash(npx create-next-app@latest ant-design-dashboard --typescript --tailwind --app --src-dir --import-alias "@/*"
       --no-git)
  ⎿  Error: /usr/bin/bash: line 1: C:Program: command not found

● Bash(npx create-next-app@latest . --typescript --tailwind --app --src-dir --import-alias "@/*")
  ⎿  Error: /usr/bin/bash: line 1: C:Program: command not found
ant-kurt collaborator · 11 months ago
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.

Currently there is a conflict between CLAUDE_CODE_GIT_BASH_PATH and CLAUDE_CODE_SHELL_PREFIX that 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 specifying CLAUDE_CODE_SHELL_PREFIX for now - we're working on a longer term fix here.

byigitt · 11 months ago
> 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. Currently there is a conflict between CLAUDE_CODE_GIT_BASH_PATH and CLAUDE_CODE_SHELL_PREFIX that 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 specifying CLAUDE_CODE_SHELL_PREFIX for now - we're working on a longer term fix here.

@ant-kurt,
Even though I removed CLAUDE_CODE_SHELL_PREFIX and only having CLAUDE_CODE_GIT_BASH_PATH - I still get the same error.

> use pnpm build

● I'll run the build command for you.

● Bash(cd /Users/user/Desktop/xxxx/xxxx && pnpm build)
  ⎿  Error: /usr/bin/bash: line 1: C:Program: command not found

<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_PREFIX variable to be zeroed, now I get this error:

xxx-dev on  dev [$!?] via  v22.14.0
❯ echo $env:CLAUDE_CODE_GIT_BASH_PATH
C:\Program Files\Git\bin\bash.exe

xxx-dev on  dev [$!?] via  v22.14.0
❯ echo $env:CLAUDE_CODE_SHELL_PREFIX

xxx-dev on  dev [$!?] via  v22.14.0
❯ claude
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                         │
│ Do you trust the files in this folder?                                                                                                                                                                                                  │
│                                                                                                                                                                                                                                         │
│ C:\Users\user\Desktop\xxx\xxx-dev                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                         │
│ Claude Code may read files in this folder. Reading untrusted files may lead Claude Code to behave in unexpected ways.                                                                                                                   │
│                                                                                                                                                                                                                                         │
│ With your permission Claude Code may execute files in this folder. Executing untrusted code is unsafe.                                                                                                                                  │
│                                                                                                                                                                                                                                         │
│ https://docs.anthropic.com/s/claude-code-security                                                                                                                                                                                       │
│                                                                                                                                                                                                                                         │
│ ❯ 1. Yes, proceed                                                                                                                                                                                                                       │
│   2. No, exit                                                                                                                                                                                                                           │
│                                                                                                                                                                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
   Enter to confirm · Esc to exit
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: C:\Users\user\Desktop\xxx\xxx-dev        │
╰───────────────────────────────────────────────────╯

 ※ Tip: Use /theme to change the color theme

> use pnpm typecheck

● I'll help you run the type check for your project. Let me execute the pnpm typecheck command.

● Bash(pnpm typecheck)
  ⎿  Error: /usr/bin/bash: Files\Git\bin\bash.exe: No such file or directory
tskimmett · 11 months ago

I'm not even using CLAUDE_CODE_SHELL_PREFIX.

sadimoodi · 11 months ago

same problem here

PCJones · 11 months ago

I found a workaround.

Problematic config:

   "sequential-thinking": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sequential-thinking"
      ]
    }

Workaround:

    "sequential-thinking": {
      "type": "stdio",
      "command": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": [
        "-c",
        "npx -y @modelcontextprotocol/server-sequential-thinking"
      ]
    }
tskimmett · 11 months ago

@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" />

PCJones · 11 months ago
@PCJones Looks like your problem was more about the note here: https://docs.anthropic.com/en/docs/claude-code/mcp#configure-mcp-servers <img alt="Image" width="1508" height="610" src="https://private-user-images.githubusercontent.com/4603206/471227694-afca750e-4895-485a-a137-786ecde2f719.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTM2MzU5OTgsIm5iZiI6MTc1MzYzNTY5OCwicGF0aCI6Ii80NjAzMjA2LzQ3MTIyNzY5NC1hZmNhNzUwZS00ODk1LTQ4NWEtYTEzNy03ODZlY2RlMmY3MTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MjdUMTcwMTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODJkM2ZlYTAwYTIwNGM4MTI0MTQ4OTUyZWQzMDczYzVlMzFiZTM3YzhjMWU5ZWFkOTExY2Y1MjkwMTUzMWNmMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.LiKp3AK3lB3HgpXZ0vkLVamgmgXsznHYlRmx5AiiASI">

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.

itskush · 11 months ago

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

gt732 · 11 months ago

This is still happening even with both combinations of ENV variables, does anyone know the fix??

eikowagenknecht · 11 months ago

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.

gt732 · 11 months ago
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 :(

nwly · 11 months ago

Seeing the same issue on both Windows 10 and 11.

shm4r7 · 11 months ago

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.

byigitt · 11 months ago

Still occuring with pnpm.

● Bash(cd C:/Users/user/xxx/xxx/xxx && pnpm typecheck)
  ⎿  Error: /usr/bin/bash: Files\Git\bin\bash.exe: No such file or directory
gt732 · 11 months ago

no one has a fix? this is burning through tokens...claude tries multiple times to call the same tool

ant-kurt collaborator · 11 months ago

We have a fix incoming - I'll share here when that's shipped.

byigitt · 11 months ago

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!

LyAhn · 11 months ago

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 CC

byigitt · 11 months ago

I've managed to make it work like this:

● The error is still coming from somewhere. Let me check environment variables:

● Bash(env | grep -i shell)
  ⎿  SHELL=/usr/bin/bash
     POWERSHELL_TELEMETRY_OPTOUT=1
     POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Pro
     … +58 lines (ctrl+r to expand)

● Let me check if there's a COMSPEC or other shell-related variable causing issues:

● Bash(env | grep -E "(COMSPEC|bash|BASH)")
  ⎿  SHELL=/usr/bin/bash
     COMSPEC=C:\Program Files\Git\bin\bash.exe
     CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

● Found it! The COMSPEC variable is set to a Git bash path with spaces. This is likely causing the issue. Let
   me unset it temporarily:

● Bash(unset COMSPEC && pnpm init)
  ⎿  Wrote to C:\Users\xxx\xxx\xxx\xxx\package.json

     {
     … +12 lines (ctrl+r to expand)

● Great! It worked. The issue was the COMSPEC environment variable. Now let's continue with the project
  setup:

● Bash(unset COMSPEC && pnpm add -D typescript @types/node tsx nodemon @types/node-cron)
  ⎿  Progress: resolved 1, reused 0, downloaded 0, added 0

     devDependencies:
     … +12 lines (ctrl+r to expand)
ant-kurt collaborator · 11 months ago

This should be resolved in 1.0.68 - we made some improvements to how we spawn sub-processes.

BumpyClock · 11 months ago

Just updated to 1.0.68 and still running into this. npm works fine but pnpm still hits the same error.

ant-kurt collaborator · 11 months ago

@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?

BumpyClock · 11 months ago

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

Claude CLI Diagnostic Currently running: native (1.0.67) Path: native Invoked: B:/~BUN/root/claude.exe Config install method: native Auto-updates enabled: true

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.

BumpyClock · 11 months ago

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 | iex again actually updated to .7 and everything works.

Sorry about the noise.

ant-kurt collaborator · 11 months ago

@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?

BumpyClock · 11 months ago

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.

github-actions[bot] · 11 months 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.