[BUG] Write tool fails with EPERM mkdir on Windows

Resolved 💬 2 comments Opened May 8, 2026 by zzyss-marker Closed Jun 6, 2026

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?

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

  1. 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'

  1. Tell the model the correct path explicitly. The very next Write call succeeds.
  1. 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_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗