[BUG] Edit/Write fail with "ENOENT: fchmod" on VM shared-folder drives when the target file already exists
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?
Title: Edit/Write fail with "ENOENT: fchmod" on VM shared-folder drives when the target file already exists
Summary
On drives that are VM shared folders (e.g. VMware HGFS / VirtualBox vboxsf, mounted as Y: and T: on the Windows guest), the Edit and Write tools fail whenever the target file already exists. Creating a new file with Write works. The atomic-write path apparently calls fchmod() to carry over the file's mode bits after writing, and the shared-folder driver rejects that syscall, so the whole operation aborts.
Error
ENOENT: fchmod
Environment
- Host: Windows 11 Enterprise LTSC 2024 (10.0.26100)
- Guest editing target: VM shared-folder drives mounted as Y:\ and T:\
- Local NTFS drive C:\ is NOT affected — all operations succeed there.
- Occurs regardless of session, and regardless of how the file was originally created.
Expected
Edit/Write on an existing file on a shared-folder drive should succeed (as it does on local NTFS), or degrade gracefully when fchmod() is unsupported.
Actual
The operation aborts with ENOENT: fchmod. The dividing line is strictly "does the target file already exist?" — not the session and not how the file was created.
Reproducibility matrix (tested)
| Operation | C: (local NTFS) | Y: / T: (shared folder) |
|---------------------------------------------|-----------------|-------------------------|
| Write - new file | OK | OK |
| Write - overwrite existing file | OK | FAIL (fchmod) |
| Edit - existing file | OK | FAIL (fchmod) |
| Edit - on a file freshly created via Write | OK | FAIL (fchmod) |
Root cause (hypothesis)
The atomic write sequence (write temp file -> copy/preserve permissions -> rename over original) issues fchmod() to preserve the existing file's mode bits. Shared-folder filesystem drivers do not implement fchmod(), so it returns ENOENT and the tool aborts. New files skip this step because there are no pre-existing permissions to preserve, which is why creating a new file works.
Impact
Any workflow that runs Claude Code against sources on a VM shared folder cannot edit existing files at all. This is common when the IDE/build (e.g. Visual Studio) runs on the host and the code is edited from a guest VM. It blocks the core editing loop.
Data safety (observed)
A failed Edit/Write leaves the target file unchanged (no truncation/data loss) and leaves no leftover .tmp file. So it is a hard failure, not a corruption — but it fully blocks editing.
Suggested fix
When fchmod() fails with ENOENT/ENOSYS/EPERM (typical on non-POSIX shared-folder filesystems), treat the permission-preservation step as best-effort: log and continue instead of aborting the whole write. The content write and rename have already succeeded; failing to re-apply mode bits should not fail the operation on filesystems that don't support it.
What Should Happen?
Edit/Write on an existing file on a shared-folder drive should succeed (as it does on local NTFS), or degrade gracefully when fchmod() is unsupported.
Error Messages/Logs
Write(_fchmod_test.txt)
⎿ Error: ENOENT: no such file or directory, fchmod
Update(_fchmod_test.txt)
⎿ Error: ENOENT: no such file or directory, fchmod
Steps to Reproduce
- On a VM shared-folder drive (Y:\ or T:\), create a file:
WritetoY:\test.txt-> succeeds. - Now modify that same existing file with
Edit, or overwrite it withWrite. - The operation fails with
ENOENT: fchmod.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.179
Claude Code Version
2.1.198
Platform
AWS Bedrock
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
Showing cached comments. Read the full discussion on GitHub ↗
7 Comments
Same problem here
I have the same problem with shared folders and can currently only work effectively with version 2.1.179.
I have the same problem. This is a major issue, as it prevents us from continuing our work at the moment.
I am also stuck at version 2.1.179.
I hope this issue will be resolved soon, since I'm not allowed to use Claude outside of VMware for privacy and security reasons.
Unfortunately, I'm having this problem too. I had to revert to the older version (2.1.179) because otherwise I can't work. This is frustrating, especially if we'll need to rely on changes in the current version in the future. I hope the problem gets fixed soon.
I'm having this issue on the latest stable version as well (v2.1.212 at the time of writing). Claude Code CLI is unusable after v2.1.179.
Same problem on my side 🙁