Skip to content

[Bug] Git Bash PATH format mismatch on Windows prevents command execution #17134

@roeia-claude

Description

@roeia-claude

Bug Description
The Problem

Claude Code on Windows with Git Bash has a PATH format mismatch.

What Claude Code Does

  1. Captures shell environment at startup into a "snapshot" file
  2. Before each command, it runs: source snapshot.sh;
  3. The snapshot contains export PATH='C:\Windows...;C:\Program Files...' (Windows format)

Why It Fails

Git Bash uses Unix-style paths for command lookup:

  • /mingw64/bin/git.exe ✓
  • C:\Program Files\Git\mingw64\bin\git.exe ✗

Even though git.exe exists and PATH contains the right directory, bash can't find it because:
PATH="C:\Program Files\Git\mingw64\bin" ← bash doesn't understand this
PATH="/mingw64/bin" ← bash understands this

The Flow (Before Fix)

  1. Claude Code runs: bash -c "source snapshot.sh; git --version"
  2. snapshot.sh does: export PATH="C:\Windows;C:\Program Files\Git..."
  3. bash tries to find 'git' using Windows paths
  4. FAILS: "git: command not found"

The Fix

The wrapper (bash-wrapper.sh) injects a PATH conversion after the snapshot:

Original command from Claude Code:

source snapshot.sh; git --version

Wrapper transforms it to:

source snapshot.sh; export PATH="$(/usr/bin/cygpath -p -u "$PATH")"; git --version

cygpath -p -u converts Windows PATH to Unix PATH:
C:\Program Files\Git\mingw64\bin → /mingw64/bin

The Flow (After Fix)

  1. Claude Code runs: wrapper.sh "source snapshot.sh; git --version"
  2. Wrapper injects PATH fix after source
  3. snapshot.sh sets: PATH="C:\Windows;..."
  4. PATH fix converts: PATH="/c/Windows:/mingw64/bin:..."
  5. bash finds 'git' at /mingw64/bin/git
  6. SUCCESS: "git version 2.52.0.windows.1"

Environment Info

  • Platform: win32
  • Terminal: WezTerm
  • Version: 2.1.2
  • Feedback ID: 40998d63-48ab-4b3f-b17f-3dded210d681

Errors

[{"error":"SyntaxError: JSON Parse error: Unexpected identifier \"C\"\n    at <parse> (:0)\n    at parse (unknown)\n    at <anonymous> (B:/~BUN/root/claude.exe:77:708)\n    at A (B:/~BUN/root/claude.exe:11:7245)\n    at <anonymous> (B:/~BUN/root/claude.exe:5002:274)\n    at <anonymous> (B:/~BUN/root/claude.exe:4992:8847)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T15:56:07.796Z"},{"error":"Error: EPERM: operation not permitted, symlink 'C:\\Users\\Roei\\.claude\\projects\\C--Users-Roei-Projects-claude-task-system\\8241966f-a5f4-4ede-8a48-10dccd495cd7\\subagents\\agent-a59b6be.jsonl' -> 'C:\\Users\\Roei\\AppData\\Local\\Temp\\claude\\C--Users-Roei-Projects-claude-task-system\\tasks\\a59b6be.output'\n    at symlinkSync (unknown)\n    at LXH (B:/~BUN/root/claude.exe:1610:9858)\n    at ZyD (B:/~BUN/root/claude.exe:1712:1306)\n    at <anonymous> (B:/~BUN/root/claude.exe:3103:22043)\n    at <anonymous> (B:/~BUN/root/claude.exe:3103:24137)\n    at run (node:async_hooks:62:22)\n    at lsH (B:/~BUN/root/claude.exe:185:14284)\n    at call (B:/~BUN/root/claude.exe:3103:21765)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T15:56:08.901Z"},{"error":"Error: EPERM: operation not permitted, symlink 'C:\\Users\\Roei\\.claude\\projects\\C--Users-Roei-Projects-claude-task-system\\8241966f-a5f4-4ede-8a48-10dccd495cd7\\subagents\\agent-a307e9f.jsonl' -> 'C:\\Users\\Roei\\AppData\\Local\\Temp\\claude\\C--Users-Roei-Projects-claude-task-system\\tasks\\a307e9f.output'\n    at symlinkSync (unknown)\n    at LXH (B:/~BUN/root/claude.exe:1610:9858)\n    at ZyD (B:/~BUN/root/claude.exe:1712:1306)\n    at <anonymous> (B:/~BUN/root/claude.exe:3103:22043)\n    at <anonymous> (B:/~BUN/root/claude.exe:3103:24137)\n    at run (node:async_hooks:62:22)\n    at lsH (B:/~BUN/root/claude.exe:185:14284)\n    at call (B:/~BUN/root/claude.exe:3103:21765)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T15:56:08.918Z"},{"error":"Error: EPERM: operation not permitted, symlink 'C:\\Users\\Roei\\.claude\\projects\\C--Users-Roei-Projects-claude-task-system\\8241966f-a5f4-4ede-8a48-10dccd495cd7\\subagents\\agent-af5dadc.jsonl' -> 'C:\\Users\\Roei\\AppData\\Local\\Temp\\claude\\C--Users-Roei-Projects-claude-task-system\\tasks\\af5dadc.output'\n    at symlinkSync (unknown)\n    at LXH (B:/~BUN/root/claude.exe:1610:9858)\n    at ZyD (B:/~BUN/root/claude.exe:1712:1306)\n    at <anonymous> (B:/~BUN/root/claude.exe:3103:22043)\n    at <anonymous> (B:/~BUN/root/claude.exe:3103:24137)\n    at run (node:async_hooks:62:22)\n    at lsH (B:/~BUN/root/claude.exe:185:14284)\n    at call (B:/~BUN/root/claude.exe:3103:21765)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T15:56:08.934Z"}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:windowsIssue specifically occurs on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions