[BUG] File edits are not atomic
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?
When Claude Code edits files with Docker/OrbStack bind mounts, the dev server
intermittently sees truncated files, causing parse errors like "Unexpected eof"
What Should Happen?
File edits should be atomic so file watchers never see partial content
Error Messages/Logs
One sample error from a NextJS dev server:
⨯ ./ui/src/components/ui/NavContent.tsx:266:23
Parsing ecmascript source code failed
> 266 | <NavItemDrag
| ^
Unexpected eof
This is persistent until either restarting the dev server, or until you touch/edit the file again to re-trigger the watcher. You can validate afterward that the on-disk contents are NOT truncated, but NextJS picks up the intermediate state.
Depending on where the non-atomic write race condition occurs exactly, various other errors can occur as well.
Steps to Reproduce
- Run a Next.js dev server in Docker with a bind mount from host
- Have Claude Code edit a .tsx file being watched
- Observe intermittent truncation errors (file cut off mid-write)
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.0.72 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
GhostTTY
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗