Edit/Write tools fail with EPERM on Windows drive root paths (e.g. D:\)
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 3 comments · opened Mar 31, 2026 · closed May 5, 2026
Description
The Edit and Write tools fail when operating on files located at the root of a Windows drive (e.g. D:\windows_watermark_v6.py).
Error
EPERM: operation not permitted, mkdir 'D:\'
Steps to reproduce
- Place a file at a Windows drive root, e.g.
D:\example.py - Attempt to use the
EditorWritetool on that file - The operation fails with the above error
Expected behavior
The tools should handle drive root paths correctly on Windows, since the directory already exists.
Actual behavior
The tools internally attempt to mkdir the target file's parent directory. When the parent is a drive root (D:\), the OS rejects the mkdir call with EPERM because drive roots already exist and cannot be "created."
Workaround
Using Python's open() via the Bash tool to write files at drive roots works fine, since it doesn't attempt to create the parent directory.
Environment
- Windows 11 Enterprise 10.0.26200
- Claude Code CLI with Bash shell
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗