[BUG] Background task .output file grew to 1.4TB filling entire disk
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?
A background Bash task in Claude Code wrote an unbounded .output file that grew to 1.4TB overnight, consuming nearly
all available disk space on a 2TB drive (went from 1.5TB free to 15GB free).
Description:
A background Bash task in Claude Code wrote an unbounded .output file that grew to 1.4TB overnight, consuming nearly
all available disk space on a 2TB drive (went from 1.5TB free to 15GB free).
What happened:
A previous Claude Code session ran a background command (likely a dev server) in the project project-project-fe. The
task output was captured to a .output file in /private/tmp/claude-501/ with no size cap. The process ran from March
15 to March 18 and the file grew to 1.4TB before I noticed.
File location:
/private/tmp/claude-501/-Users-userxx-Desktop-Work-xx-xx-fe/d718ea19-4a72-4943-89ec-fadb04f4e3d7/tasks
/bj5c1wjbo.output
File details:
-rw-r--r-- 1 userxx wheel 1.4T Mar 15 09:32 bj5c1wjbo.output
Environment:
- macOS Darwin 25.2.0 (Apple Silicon)
- 2TB APFS disk
- Claude Code with Opus 4.6
Actual behavior:
No size limit exists on .output files. Long-running background tasks (dev servers, watch commands, etc.) that produce
continuous stdout output can fill the entire disk unnoticed.
Suggested fix:
- Add a max file size limit for task output files
- Truncate or rotate output when the limit is reached
- Optionally warn the user when a background task's output exceeds a threshold
- Auto-cleanup stale task output files from previous sessions
What Should Happen?
Expected behavior:
Background task .output files should have a maximum size cap (e.g., 50-100MB) with rotation or truncation to prevent
filling the user's disk.
Error Messages/Logs
Steps to Reproduce
- Open Claude Code in a project that has a dev server (e.g., Next.js, Vite, etc.)
- Ask Claude to run something like "start the dev server" or "run npm run dev" — or have Claude run any long-lived
command using run_in_background: true in the Bash tool
- The command starts running in the background, with stdout/stderr piped to a .output file under
/private/tmp/claude-501/<project>/<session>/tasks/<task-id>.output
- Close or leave the Claude Code session without stopping the background task
- The process continues running indefinitely, writing output (e.g., HMR updates, request logs) to the .output file
with no size limit
- Over hours/days, the file grows unbounded until disk is full
Key issue: There is no size cap, rotation, or auto-cleanup on background task .output files. The process also isn't
killed when the Claude Code session ends.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Version: 2.1.78
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗