Disk Space Full During Operation Fix (2026)
The Error
Error: ENOSPC: no space left on device, write '/project/src/generated/schema.ts'
Disk usage: 100% (0 bytes available)
Claude Code cannot write files, create commits, or save conversation state
Operation aborted — partial writes may have corrupted files
This appears when the filesystem runs out of space during a Claude Code operation, potentially leaving files in a partially written state.
The Fix
# Check disk usage:
df -h /
# Clear common space consumers:
rm -rf /tmp/claude-*
npm cache clean --force
docker system prune -f
- Check available disk space with
df -h. - Clear temporary files, npm cache, and Docker artifacts.
- Verify files written during the failure are intact:
git diff.
Why This Happens
Claude Code writes files to disk, creates git commits (which consume space in .git/), and stores conversation history. On machines with small SSDs, CI runners with limited disk, or Docker containers with constrained storage, space can run out during operation. Large node_modules directories (often 500MB+), Docker images, and accumulated build artifacts are the most common space consumers. When the disk fills up mid-write, files can be truncated or corrupted.
If That Doesn’t Work
Find the largest directories consuming space:
du -sh /* 2>/dev/null | sort -rh | head -20
du -sh ~/Library/Caches/* 2>/dev/null | sort -rh | head -10
Clean up node_modules from old projects:
find ~ -name "node_modules" -type d -maxdepth 4 | xargs du -sh | sort -rh | head -10
# Delete unused ones:
rm -rf /path/to/old-project/node_modules
Clear git garbage collection:
git gc --aggressive --prune=now
Check for and fix corrupted files from the disk-full write:
git status
git checkout -- path/to/corrupted-file.ts
Prevention
# CLAUDE.md rule
Maintain at least 5GB free disk space. Run 'df -h' at session start to verify. Clean npm cache monthly with 'npm cache clean --force'. Add a CLAUDE.md reminder to check disk space before large operations.
See Also
Related Error Messages
This fix also applies if you see variations of this error:
- Connection or process errors with similar root causes in the same subsystem
- Timeout variants where the operation starts but does not complete
- Permission variants where access is denied to the same resource
- Configuration variants where the same setting is missing or malformed
If your specific error message differs slightly from the one shown above, the fix is likely the same. The key indicator is the operation that failed (shown in the stack trace) rather than the exact wording of the message.
Frequently Asked Questions
Does this error affect all operating systems?
This error can occur on macOS, Linux, and Windows (WSL). The exact error message may differ slightly between platforms, but the root cause and fix are the same. macOS users may see additional Gatekeeper or notarization prompts. Linux users should check that the relevant system packages are installed. Windows users should ensure they are running inside WSL2, not native Windows.
Will this error come back after updating Claude Code?
Updates can occasionally reintroduce this error if the update changes default configurations or dependency requirements. After updating Claude Code, verify your project still builds and runs correctly. If the error returns, reapply the fix and check the changelog for breaking changes.
Can this error cause data loss?
No, this error occurs before or during an operation and does not corrupt existing files. Claude Code’s edit operations are atomic — they either complete fully or not at all. However, if the error occurs during a multi-step operation, you may have partial changes that need to be reviewed with git diff before continuing.
How do I report this error to Anthropic if the fix does not work?
Open an issue at github.com/anthropics/claude-code with: (1) the full error message including stack trace, (2) your Node.js version (node --version), (3) your Claude Code version (claude --version), (4) your operating system and version, and (5) the command or operation that triggered the error.
Find the right skill → Browse 155+ skills in our Skill Finder.
Related Guides
Try it: Paste your error into our Error Diagnostic for an instant fix.