[BUG] Runaway .output file growth when task repeatedly outputs errors — no size limit or auto-termination
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?
When a task created via TaskCreate executes a shell command that repeatedly outputs errors in a loop, the .output file
grows indefinitely with no automatic termination and no user notification.
In my case, a PowerShell syntax error (\ being misinterpreted as a command) was emitted on every iteration of a
long-running task. The process ran unattended for ~21 hours, producing a 180 GB output file with no warnings or
safeguards triggered.
What Should Happen?
- Task should auto-terminate when the .output file exceeds a configurable size threshold (e.g. 100 MB)
- Task should auto-terminate when the same error pattern repeats N consecutive times (e.g. 10)
- User should be notified when a task is force-terminated due to these limits
- Limits should be configurable per-session (via CLAUDE.md) or globally (via settings.json):
{
"task": {
"maxOutputSizeMB": 100,
"maxConsecutiveErrors": 10,
"onLimitExceeded": "terminate"
}
}
Error Messages/Logs
Repeated content found in .output file:
'\' is not recognized as the name of a cmdlet, function, script file, or operable program.
+ \ = 'C:\Users\<user>\fix_planspage.py'
+ ~
+ CategoryInfo : ObjectNotFound: (\:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Output file location:
%LOCALAPPDATA%\Temp\claude\<project-slug>\tasks\<task-id>.output
Output file stats:
Size: 192,796,228,747 bytes (~180 GB)
Created: Day 1, 19:45
Modified: Day 2, 17:17 (~21 hours of continuous writing)
Steps to Reproduce
- Open Claude Code on Windows
- Start a task via TaskCreate that runs a shell command with a syntax error in a loop, e.g.:
Run the following PowerShell command: \ = 'C:\some\script.py'
- Leave the task running unattended in the background
- Check %LOCALAPPDATA%\Temp\claude\<project>\tasks\<task-id>.output
- Observe the file growing continuously with the same error repeated indefinitely
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.45
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗