Write tool fails on new/empty files: 'File has not been read yet'
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 3 comments · opened Jan 13, 2026 · closed Mar 5, 2026
Problem
The Write tool requires a prior Read call before writing to a file. This creates a catch-22 for new or empty files:
- Write requires Read first
- Read on empty/non-existent file doesn't register as successful read
- Write refuses to work
Error message
File has not been read yet. Read it first before writing to it.
Expected behavior
Write tool should allow creating new files without requiring a Read call first. The Read requirement makes sense for existing files (to prevent accidental overwrites), but not for new file creation.
Workaround
Using Bash with echo or cat > to create new files instead of Write tool.
Environment
- OS: Windows 11 (Git Bash / MINGW64)
- Claude Code version: latest (npm)
Suggested fix
Skip the "file has been read" check when the target file doesn't exist or is empty.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗