EEXIST: file already exists, mkdir when Edit tool updates files in existing directories on Windows
Resolved 💬 2 comments Opened Mar 5, 2026 by matthendrix Closed Mar 5, 2026
Environment
- OS: Windows 11 Pro
- Claude Code version: 2.1.69
- Shell: Git Bash (bash)
Description
When the Edit tool attempts to update an existing file (e.g. app/page.tsx in a Next.js project), Claude Code tries to mkdir the parent directory even though it already exists. On Windows, this throws EEXIST: file already exists, mkdir '<path>' instead of silently continuing.
Repro
- Open a Next.js project on Windows where
app/directory exists - Ask Claude to edit
app/page.tsx - Edit tool fails with:
Error: EEXIST: file already exists, mkdir 'C:\path\to\project\app'
Expected behaviour
Edit tool should handle the case where the parent directory already exists (skip mkdir or use mkdir -p equivalent).
Workaround
None at the model level — Claude falls back to Bash scripts which may also fail depending on environment.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗