Edit tool fails with EEXIST error on Windows (Git Bash) in v2.1.69
Description
The Edit tool consistently fails with EEXIST: file already exists, mkdir error on Windows when using Git Bash as the shell. This affects all Edit tool calls — no file can be edited.
Environment
- OS: Windows 11 Pro
- Shell: Git Bash (via bash)
- Claude Code version: 2.1.69 (broken), 2.1.61 (works fine)
- Node.js: bundled with Claude Code
Steps to Reproduce
- Install Claude Code v2.1.69 on Windows with Git Bash as the default shell
- Attempt any Edit tool operation on any file
Expected Behavior
The Edit tool should successfully modify the file.
Actual Behavior
Every Edit call fails with:
EEXIST: file already exists, mkdir
Root Cause Analysis
The issue appears to be in how path.dirname() handles Windows backslash paths inside Git Bash's POSIX environment.
In Git Bash on Windows:
path.dirname('C:\Foo\Bar\file.txt')
// Returns: 'C:' (incorrect — treats entire backslash path as filename)
// Expected: 'C:\Foo\Bar'
This causes mkdirSync('C:') to be called, which fails with EEXIST because C: already exists as a drive root.
Additionally, the broken path handling creates junk directories in the working directory with concatenated path segments (e.g., a directory named Projectskurumsalxhaberv4KurumsalxHaberLib appeared in the repo root).
Workaround
Downgrading to v2.1.61 resolves the issue:
claude install 2.1.61
Additional Context
- The issue is specific to the combination of Windows + Git Bash
- v2.1.61 does not have this problem, suggesting a regression was introduced in a later version
- The
pathmodule behavior differs between native Windows Node.js and Git Bash's POSIX layer —path.dirname()needs to handle both forward and backslash separators correctly
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗