[BUG] Edit/Write tool fails with EEXIST on OneDrive paths (Windows)
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?
Edit and Write tools fail with EEXIST: file already exists, mkdir '<path>' when targeting files inside OneDrive-synced folders. The Read tool works fine on the same path. The tool internally calls mkdir on the parent directory before writing, which fails because the directory already exists.
What Should Happen?
Edit/Write tools should work normally on OneDrive paths. The mkdir call should use { recursive: true } or skip mkdir if the directory already exists.
Error Messages/Logs
EEXIST: file already exists, mkdir 'C:\Users\...\OneDrive\...'
Steps to Reproduce
- Have a file inside a OneDrive-synced folder on Windows
- Use Read tool on the file — works fine
- Use Edit tool on the same file — fails with EEXIST
- Write tool also fails with same error
- Pausing OneDrive sync does not fix it
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude for Windows 1.1.5749
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Tested 10+ times in single session. Both forward slashes and backslashes produce same error. Bug appeared after updating Claude Code.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗