Claude Code fills entire disk via /tmp/claude-{uid} temp files (771 GB crash loop)
Resolved 💬 2 comments Opened Apr 11, 2026 by luckymikey999-coder Closed May 25, 2026
Bug Report
Claude Code version: v2.1.101
OS: macOS Sequoia (Darwin 25.4.0), Mac Mini M2 Pro 32GB
Filesystem: APFS, 926 GB volume
Problem
Claude Code wrote ~771 GB of temporary files to /private/tmp/claude-501, filling a 1TB drive to 100% (101 MB free). This caused Claude Code itself to crash with "Configuration Error: invalid JSON" because it couldn't write to ~/.claude.json, which then triggered a restart loop creating even more temp files.
Timeline
~/.claude.jsonwas corrupted (truncated mid-write, likely during an SDK session refresh)- Claude Code detects corrupted config → crashes
- On restart, writes temp files to
/private/tmp/claude-501 - Crashes again → restarts → writes more temp files
- Disk fills to 100% → config writes fail even harder → infinite loop
- All other services on the machine were affected (
tee: No space left on device, Telegram bot 409 conflicts, etc.)
Evidence from logs
Claude configuration file at /Users/mini/.claude.json is corrupted: JSON Parse error: Unable to parse JSON string
The corrupted file has been backed up to: /Users/mini/.claude/backups/.claude.json.corrupted.1775866517894
A backup file exists at: /Users/mini/.claude/backups/.claude.json.backup.1775865061735
This message repeated 50+ times in stderr, each iteration creating more temp data.
tee: /Users/mini/.openclaw/logs/preflight.log: No space left on device
tee: stdout: No space left on device
Impact
- 771 GB of temp files written to
/private/tmp/claude-501 - Disk filled to 100%, all services on the machine affected
- Required manual intervention:
sudo rm -rf /private/tmp/claude-501+ reboot - ~45 minutes of downtime to diagnose and recover
Expected Behavior
- Claude Code should not write hundreds of GB to
/tmp— there should be a size limit or periodic cleanup for temp files - A corrupted
~/.claude.jsonshould not cause an infinite restart loop — after N failures, Claude Code should stop retrying or recreate the config from the backup it already detects - The backup detection message shows Claude Code knows a backup exists but doesn't auto-restore from it
Suggested Fixes
- Add a max size cap for
/tmp/claude-{uid}(e.g., 5 GB) with automatic cleanup of old temp files - On config corruption: auto-restore from backup after first detection instead of crash-looping
- Add a circuit breaker: if Claude Code crashes N times within M minutes, stop restarting and log a clear error
Workaround
sudo rm -rf /private/tmp/claude-501
cp ~/.claude/backups/.claude.json.backup.* ~/.claude.json
# reboot to clear any stuck processesThis issue has 2 comments on GitHub. Read the full discussion on GitHub ↗