Task output collector creates self-referential infinite loop, filled 696GB disk
Environment:
- Claude Code 2.1.76
- macOS 26.2 (arm64, Apple Silicon)
- APFS, 926GB disk
What happened:
A session (08c31379-90f1-4aeb-9677-1e4582b41df6, slug replicated-swimming-valiant) spawned multiple Explore subagents. The task output infrastructure created a collector file at /private/tmp/claude-501/-Users-goblinz/<session>/tasks/bor4u239r.output.
This file grew to 747,029,025,888 bytes (696GB) in approximately 23 minutes (created 17:09, last modified 17:32 on March 14), filling the disk from ~700GB free to <5GB free.
Root cause (suspected):
The collector file begins with an ls -la of the tasks directory, then concatenates each *.output file with === <filename>.output === headers. The collector's own file (bor4u239r.output) lives in the same directory it's reading. It appears to have read its own growing output, creating an infinite feedback loop. A second file (bp6zb28m7.output, 64MB) shows the same pattern at smaller scale.
Evidence:
# Head of the 696GB file — it's listing its own directory:
total 0
drwxr-xr-x@ 8 goblinz wheel 256 Mar 14 17:10 .
drwxr-xr-x@ 3 goblinz wheel 96 Mar 14 17:09 ..
lrwxr-xr-x@ 1 goblinz wheel 123 ... a75e54d4834c19c43.output -> .../subagents/agent-a75e54d4834c19c43.jsonl
...
-rw-r--r--@ 1 goblinz wheel 0 ... bor4u239r.output # itself, at size 0 when listing started
---
=== a75e54d4834c19c43.output ===
{"parentUuid":... # then full JSONL streams from all subagents
Impact: Silent disk exhaustion. No warning, no size cap. User discovered it manually when macOS reported 8GB remaining. The file had to be deleted and the wc process holding the file handle killed before APFS reclaimed space.
Expected behavior: Task output collection should exclude its own file from aggregation, or have a size cap, or both.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗