Edit tool: fails when linter/formatter modifies file between Read and Edit
Resolved 💬 3 comments Opened Apr 20, 2026 by IanVand Closed Apr 24, 2026
Problem
The Edit tool fails with "File has been modified since read, either by the user or by a linter" when an auto-formatter or pre-commit hook modifies the file after Read but before Edit.
This is a race condition in any project with:
- Format-on-save (Prettier, Black, isort, etc.)
- Auto-fix ESLint rules
- Editor auto-save with formatting
The user has no control over this timing, and the only workaround is to re-read the file and try again — which can loop if the formatter keeps running.
Impact
Workflow blocker for projects with auto-formatters. Observed consistently over 26+ days.
Suggested Fixes (any of these would help)
- Auto-re-read: When the modification is detected, automatically re-read the file and retry the match against the new content.
- Show what changed: Display a diff between expected and actual file content so the user can understand what the formatter did.
- Brief retry window: Wait 500ms after detecting a modification, re-read, and retry once before failing.
Option 1 would fully solve the problem. Option 2 would at least make debugging faster.
Environment
- Claude Code CLI on Windows 11
- VS Code with format-on-save enabled
- Projects using Black, Prettier, and pre-commit hooks
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗