[BUG] Subagent task output file written in infinite loop — 359 GB from 102 unique lines in 2mins
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?
What happened:
A subagent was spawned to research product mappings. It completed in ~2.5 minutes producing
~102 unique output lines. The task output streaming got stuck in a loop and kept appending the same lines for inflating the temp file to 359 GB. No process was holding the file open when discovered (loop had
stopped on its own). macOS reported this as "System Data: 412 GB".
Details of the bug:
⏺ Claude Code version: 2.1.61
OS: macOS (Darwin 25.3.0)
Session ID: eb145dfe-2f00-44af-b6d0-3ed6622f3abd
Agent ID: a13e5979f1fea98fc
Agent slug: eager-jumping-lark
Task output file: /private/tmp/claude-501/-Users-ivaylohristov-Desktop-repos-packing-backend/tasks/bgljxv3s7.output
File size: 359.4 GB (385,922,695,168 bytes)
Total lines: 205,800,694
Unique lines: ~102
Task duration: ~2.5 min (08:44:49 – 08:47:33 UTC, Feb 27 2026)
File last modified: Feb 27 12:57 (loop continued ~4 hours after task ended)
What Should Happen?
It should definitely not create a ~400GB file form ~100 lines in a infinite loop.
Error Messages/Logs
No error messages just a large file in /tmp/claude-bug-sample.txt
Steps to Reproduce
No steps to reproduce.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.61
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 ↗