claude-code - 💡(How to fix) Fix [BUG] Write tool fails with EPERM mkdir on Windows

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

  1. A few turns later (without changing dirs), Write fails again with the same EPERM error.

Code Example

EPERM: operation not permitted, mkdir 'C:\Users\user'

---

$ pwd
     /c/Users/user/project/Desktop/web
     $ cygpath -w "$(pwd)"
     C:\Users\Pixiu\Desktop\web
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Write fails on Windows with EPERM: operation not permitted, mkdir 'C:\Users\user'. Read, Edit and Bash work with the same path — only Write breaks. Telling the model the correct path makes the next Write succeed, but the fix doesn't stick — subsequent Write calls revert to the same EPERM. So the bad path resolution lives in some cached/stale state that gets restored every turn.

What Should Happen?

Write should resolve paths the same way Read/Edit do, or stat parents before mkdir-ing them. It should never try to mkdir C:\Users or other system-managed

Error Messages/Logs

EPERM: operation not permitted, mkdir 'C:\Users\user'

Steps to Reproduce

  1. Open a session in a working dir whose harness-reported path differs from the real disk path:
     $ pwd
     /c/Users/user/project/Desktop/web
     $ cygpath -w "$(pwd)"
     C:\Users\Pixiu\Desktop\web
  1. Create a target dir from Bash so it physically exists: mkdir -p site

  2. Call Write to create a new file under it:

    Write({ file_path: "C:\Users\user\project\Desktop\web\site\new.txt", content: "x" })→ EPERM: operation not permitted, mkdir 'C:\Users\user'

  3. Tell the model the correct path explicitly. The very next Write call succeeds.

  4. A few turns later (without changing dirs), Write fails again with the same EPERM error.

So the path resolution is recoverable per-call but resets — it's some piece of cached/stale state, not a permanent misconfiguration.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.133

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING