claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Critical Bug - Claude Code forces non-existent cygpath on Windows, ignoring available shells

Open whatcher1074 opened this issue 5 months ago • 6 comments

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?

Environment:

  • Claude Code Version: 1.0.112 (installed via npm)
  • Platform: Windows 10/11 (win32)
  • Node Version: v22.18.0
  • Available Shells: WSL (installed), Git Bash (installed), PowerShell, CMD
  • Cygwin: NOT installed
  • Working Directory: C:\Users\13581432

Issue Description:

Claude Code v1.0.112 fails to execute ANY commands on Windows, forcing the use of cygpath (a Cygwin utility) even when:

  1. Cygwin is NOT installed on the system
  2. WSL is installed and available
  3. Git Bash/MSYS is installed and available
  4. Running FROM within Git Bash terminal
  5. The same setup worked 3 days ago (before update)

Error Messages:

  1. When trying to run any bash command: Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.

  2. When using file tools (Glob, etc.): Error: Command failed: cygpath -u 'C:\Users\13581432' at genericNodeError (node:internal/errors:983:15) at wrappedFn (node:internal/errors:537:14) at checkExecSyncError (node:child_process:915:11) at execSync (node:child_process:987:15) at Tk (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:755:1044) ... status: 4294967295, signal: null, pid: 29168, stdout: <Buffer 49 00 6e 00 76 00 61 00 6c 00 69 00 64 00...>

Steps to Reproduce:

  1. Install Claude Code on Windows: npm install -g @anthropic-ai/claude-code
  2. Run claude from PowerShell, CMD, or Git Bash
  3. Try any command like dir, ls, or use file tools
  4. Observe cygpath error even though cygwin is not installed

Attempted Solutions (All Failed):

  1. ✗ Running from PowerShell
  2. ✗ Running from Git Bash terminal
  3. ✗ Running from WSL terminal
  4. ✗ Setting environment variables: - $env:SHELL = "C:\Windows\System32\wsl.exe" - $env:SHELL = "/usr/bin/bash" - $env:MSYS_NO_PATHCONV = 1 - $env:WSL_DISTRO_NAME = "Ubuntu"
  5. ✗ Running with wsl claude
  6. ✗ Using Git Bash's MSYS environment
  7. ✗ Creating fake cygpath.bat (causes path mangling: C:\Users becomes C:\c\Users)

Root Cause:

Claude Code v1.0.112 has hardcoded dependency on cygpath for Windows path conversion without:

  • Checking if cygpath/Cygwin exists
  • Falling back to WSL's wslpath
  • Using Git Bash's MSYS path handling
  • Supporting native Windows paths

Comparison:

  • Work laptop: Fails with cygpath error (no Cygwin installed)
  • Personal laptop: Works (possibly has different version or Cygwin remnants)
  • 3 days ago: Worked on same work laptop (before update)

Expected Behavior:

Claude Code should:

  1. Detect available shells (WSL, Git Bash, PowerShell)
  2. Use appropriate path conversion for detected environment
  3. NOT require Cygwin/cygpath when other shells are available
  4. Fall back gracefully when cygpath doesn't exist

Impact:

Claude Code is completely unusable on Windows systems without Cygwin, making it a showstopper bug for Windows users.

What Should Happen?

Expected Behavior:

Claude Code should:

  1. Detect available shells (WSL, Git Bash, PowerShell)
  2. Use appropriate path conversion for detected environment
  3. NOT require Cygwin/cygpath when other shells are available
  4. Fall back gracefully when cygpath doesn't exist

Error Messages/Logs

dows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\13581432>  export CLAUDE_SHELL="/mnt/c/Windows/System32/wsl.exe"
export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:2
+  export CLAUDE_SHELL="/mnt/c/Windows/System32/wsl.exe"
+  ~~~~~~
    + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\13581432>   export SHELL="/mnt/c/Windows/System32/wsl.exe"
export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
+   export SHELL="/mnt/c/Windows/System32/wsl.exe"
+   ~~~~~~
    + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\13581432>   export NO_CYGPATH=1
export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
+   export NO_CYGPATH=1
+   ~~~~~~
    + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\13581432>
PS C:\Users\13581432>   $env:SHELL = "C:\Windows\System32\wsl.exe"
PS C:\Users\13581432>   $env:BASH = "C:\Windows\System32\wsl.exe"
PS C:\Users\13581432>   $env:BASH_PATH = "C:\Windows\System32\wsl.exe"
PS C:\Users\13581432>   claude
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                          │
│ Do you trust the files in this folder?                                                                                                                   │
│                                                                                                                                                          │
│ C:\Users\13581432                                                                                                                                        │
│                                                                                                                                                          │
│ Claude Code may read, write, or execute files contained in this directory. This can pose security risks, so only use files and bash commands from        │
│ trusted sources.                                                                                                                                         │
│                                                                                                                                                          │
│ Execution allowed by:                                                                                                                                    │
│                                                                                                                                                          │
│   • .claude/settings.local.json                                                                                                                          │
│                                                                                                                                                          │
│ Learn more ( 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\13581432                          │
╰───────────────────────────────────────────────────╯

> cwd C:\Users\13581432\OneDrive - Signet Jewelers\Documents\healthcheck

● I'll help you with tasks in the healthcheck directory. What would you like me to do?

> whats in the folder

● Bash(dir)
  ⎿  Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL
     environment variable set.

● Bash(cmd /c dir)
  ⎿  Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL
     environment variable set.

● Let me try a different approach to list the contents:
Error: Command failed: cygpath -u 'C:\Users\13581432'
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:915:11)
    at execSync (node:child_process:987:15)
    at Tk (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:755:1044)
    at XqB (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:2697)
    at da (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3698)
    at file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3484
    at Array.some (<anonymous>)
    at nq (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3474) {
  status: 4294967295,
  signal: null,
  output: [
    null,
    <Buffer 49 00 6e 00 76 00 61 00 6c 00 69 00 64 00 20 00 63 00 6f 00 6d 00 6d 00 61 00 6e 00 64 00 20 00 6c 00 69 00 6e 00 65 00 20 00 61 00 72 00 67 00 75 00 ... 154 more bytes>,
    <Buffer >
  ],
  pid: 29168,
  stdout: <Buffer 49 00 6e 00 76 00 61 00 6c 00 69 00 64 00 20 00 63 00 6f 00 6d 00 6d 00 61 00 6e 00 64 00 20 00 6c 00 69 00 6e 00 65 00 20 00 61 00 72 00 67 00 75 00 ... 154 more bytes>,
  stderr: <Buffer >
}

  ERROR  Command failed: cygpath -u 'C:\Users\13581432'

 node:internal/errors:983:15

 - genericNodeError (node:internal/errors:983:15)
 - wrappedFn (node:internal/errors:537:14)
 - checkExecSyncError (node:child_process:915:11)
 - execSync (node:child_process:987:15)
 - Tk (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:755:1044)
 - XqB (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:2697)
 - da (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3698)
 -  (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3484)
 -     at Array.some (<anonymous>)
 - nq (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3474)

PS C:\Users\13581432>  echo '@echo %2' > C:\Windows\cygpath.bat
out-file : Access to the path 'C:\Windows\cygpath.bat' is denied.
At line:1 char:2
+  echo '@echo %2' > C:\Windows\cygpath.bat
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

PS C:\Users\13581432>
PS C:\Users\13581432>   echo '@echo %2' > C:\Windows\System32\cygpath.bat
out-file : Access to the path 'C:\Windows\System32\cygpath.bat' is denied.
At line:1 char:3
+   echo '@echo %2' > C:\Windows\System32\cygpath.bat
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

PS C:\Users\13581432>   echo '@echo %2' > C:\Windows\cygpath.bat
out-file : Access to the path 'C:\Windows\cygpath.bat' is denied.
At line:1 char:3
+   echo '@echo %2' > C:\Windows\cygpath.bat
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

PS C:\Users\13581432>   echo '@echo %2' > C:\Users\13581432\cygpath.bat
PS C:\Users\13581432>   claude
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                          │
│ Do you trust the files in this folder?                                                                                                                   │
│                                                                                                                                                          │
│ C:\Users\13581432                                                                                                                                        │
│                                                                                                                                                          │
│ Claude Code may read, write, or execute files contained in this directory. This can pose security risks, so only use files and bash commands from        │
│ trusted sources.                                                                                                                                         │
│                                                                                                                                                          │
│ Execution allowed by:                                                                                                                                    │
│                                                                                                                                                          │
│   • .claude/settings.local.json                                                                                                                          │
│                                                                                                                                                          │
│ Learn more ( 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\13581432                          │
╰───────────────────────────────────────────────────╯

> do an ls

● Bash(ls)
  ⎿  Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL
     environment variable set.

● Bash(dir)
  ⎿  Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL
     environment variable set.

● Bash(cmd /c dir)
  ⎿  Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL
     environment variable set.

● It seems the shell environment isn't properly configured. Let me use the Glob tool to list the files:
Error: Command failed: cygpath -u 'C:\Users\13581432'
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:915:11)
    at execSync (node:child_process:987:15)
    at Tk (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:755:1044)
    at XqB (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:2697)
    at da (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3698)
    at file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3484
    at Array.some (<anonymous>)
    at nq (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3474) {
  status: 4294967295,
  signal: null,
  output: [
    null,
    <Buffer 49 00 6e 00 76 00 61 00 6c 00 69 00 64 00 20 00 63 00 6f 00 6d 00 6d 00 61 00 6e 00 64 00 20 00 6c 00 69 00 6e 00 65 00 20 00 61 00 72 00 67 00 75 00 ... 154 more bytes>,
    <Buffer >
  ],
  pid: 31564,
  stdout: <Buffer 49 00 6e 00 76 00 61 00 6c 00 69 00 64 00 20 00 63 00 6f 00 6d 00 6d 00 61 00 6e 00 64 00 20 00 6c 00 69 00 6e 00 65 00 20 00 61 00 72 00 67 00 75 00 ... 154 more bytes>,
  stderr: <Buffer >
}

  ERROR  Command failed: cygpath -u 'C:\Users\13581432'

 node:internal/errors:983:15

 - genericNodeError (node:internal/errors:983:15)
 - wrappedFn (node:internal/errors:537:14)
 - checkExecSyncError (node:child_process:915:11)
 - execSync (node:child_process:987:15)
 - Tk (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:755:1044)
 - XqB (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:2697)
 - da (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3698)
 -  (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3484)
 -     at Array.some (<anonymous>)
 - nq (file:///C:/Users/13581432/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3507:3474)

Steps to Reproduce

Steps to Reproduce:

  1. Install Claude Code on Windows: npm install -g @anthropic-ai/claude-code
  2. Run claude from PowerShell, CMD, or Git Bash
  3. Try any command like dir, ls, or use file tools
  4. Observe cygpath error even though cygwin is not installed

Attempted Solutions (All Failed):

  1. ✗ Running from PowerShell
  2. ✗ Running from Git Bash terminal
  3. ✗ Running from WSL terminal
  4. ✗ Setting environment variables: - $env:SHELL = "C:\Windows\System32\wsl.exe" - $env:SHELL = "/usr/bin/bash" - $env:MSYS_NO_PATHCONV = 1 - $env:WSL_DISTRO_NAME = "Ubuntu"
  5. ✗ Running with wsl claude
  6. ✗ Using Git Bash's MSYS environment
  7. ✗ Creating fake cygpath.bat (causes path mangling: C:\Users becomes C:\c\Users)

Root Cause:

Claude Code v1.0.112 has hardcoded dependency on cygpath for Windows path conversion without:

  • Checking if cygpath/Cygwin exists
  • Falling back to WSL's wslpath
  • Using Git Bash's MSYS path handling
  • Supporting native Windows paths

Comparison:

  • Work laptop: Fails with cygpath error (no Cygwin installed)
  • Personal laptop: Works (possibly has different version or Cygwin remnants)
  • 3 days ago: Worked on same work laptop (before update)

Expected Behavior:

Claude Code should:

  1. Detect available shells (WSL, Git Bash, PowerShell)
  2. Use appropriate path conversion for detected environment
  3. NOT require Cygwin/cygpath when other shells are available
  4. Fall back gracefully when cygpath doesn't exist

Impact:

Claude Code is completely unusable on Windows systems without Cygwin, making it a showstopper bug for Windows users.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

1.0.112 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

No response

whatcher1074 avatar Sep 12 '25 16:09 whatcher1074

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7480
  2. https://github.com/anthropics/claude-code/issues/7470

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 12 '25 16:09 github-actions[bot]

I did all of those things and this doesnt resolve the issue it is a bug please test reproduce and confirm.

On Fri, Sep 12, 2025 at 12:47 PM github-actions[bot] < @.***> wrote:

github-actions[bot] left a comment (anthropics/claude-code#7528) https://github.com/anthropics/claude-code/issues/7528#issuecomment-3286039142

Found 2 possible duplicate issues:

  1. #7480 https://github.com/anthropics/claude-code/issues/7480
  2. #7470 https://github.com/anthropics/claude-code/issues/7470

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code https://claude.ai/code

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/7528#issuecomment-3286039142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL5NMWF7YZIWX5VA6LKUFKL3SL2LPAVCNFSM6AAAAACGLQUWWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBWGAZTSMJUGI . You are receiving this because you authored the thread.Message ID: @.***>

whatcher1074 avatar Sep 12 '25 17:09 whatcher1074

SOLUTION FOUND

DIAGNOSIS

  • Claude Code on Windows uses C:\Program Files\Git\usr\bin\cygpath.exe (hardcoded) to translate Windows<->Unix paths
  • This is part of Cygwin (too big to install) and also part of Git Bash
  • Git can be installed in TWO places on Windows C:\Program Files\Git (as above) and %USERDIR%\AppData\Local\Git
  • Default (either by Git installer or winget) is to install to %USERDIR\Git
  • Hence Claude Code can't find and complains / fails / crashes

SOLUTION

  • Check where your git is installed where git.exe
  • If in C:\Program Files\Git then do nothing
  • If in %USERDIR% or not installed run winget install --scope machine git.git -> installs to C:\Program Files\Git -> Claude Code can now find

dimension-zero avatar Oct 09 '25 09:10 dimension-zero

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 07 '25 10:12 github-actions[bot]

Another solution that I found is to set your "CLAUDE_CODE_GIT_BASH_PATH" environment variable with the installation of where your git bash is. Just run [Environment]::GetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "User") to verify that it isn't the same location as where git returns. If they are different, rectify this, git doesn't need to be reinstalled.

vmonteleone avatar Dec 09 '25 19:12 vmonteleone