[BUG]

Resolved 💬 3 comments Opened Feb 20, 2026 by pierrefrns Closed Mar 24, 2026

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 using the Task tool to spawn multiple sub-agents, the parent task's .output file recursively includes itself during output aggregation, creating an infinite self-referencing loop that fills the disk completely.

The parent task (b4985d6) aggregates all *.output files from the tasks/ directory. However, the parent's own output file (b4985d6.output) is located in the same tasks/ directory alongside the sub-agent outputs. This causes the parent to read and append its own growing output in an infinite loop.

Details:
Claude spawned 4 sub-agents for parallel code review. The tasks/ directory ended up like this:

~/.claude/tmp/claude-1001//tasks/
a1689fc.output -> symlink to subagents/agent-a1689fc.jsonl (OK)
a26810f.output -> symlink to subagents/agent-a26810f.jsonl (OK)
a6d9aab.output -> symlink to subagents/agent-a6d9aab.jsonl (OK)
a96152c.output -> symlink to subagents/agent-a96152c.jsonl (OK)
b4985d6.output -> regular file, 143GB (BUG)

The sub-agent outputs are symlinks to JSONL session files (a few MB each). The parent task output (b4985d6.output) is a regular file in the same
directory.

The parent task concatenated all *.output files, including itself. The file content shows:

=== a1689fc.output ===
{...sub-agent 1 JSON output...}
=== a26810f.output ===
{...sub-agent 2 JSON output...}
=== a6d9aab.output ===
{...sub-agent 3 JSON output...}
=== a96152c.output ===
{...sub-agent 4 JSON output...}
=== b4985d6.output === ← self-reference starts here
{...repeats everything above, including itself...}
=== b4985d6.output === ← and again
{...}

The marker === b4985d6.output === appears 9,555,936 times in the file. The file grew to 152,694,374,401 bytes (143GB) in approximately 6 minutes
before filling the 290GB disk.

What Should Happen?

The parent task's output aggregation should exclude its own output file from the list of files to concatenate, or the parent output file should be written to a different location than the sub-agent outputs.

Error Messages/Logs

Steps to Reproduce

  1. Open a Claude Code session in a project directory
  2. Ask Claude to spawn multiple sub-agents (e.g. "launch several teammates to review the code")
  3. Claude spawns sub-agents via the Task tool
  4. The parent task aggregates outputs → disk fills up

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.46

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Cursor

Additional Information

## Related Issues

This is a distinct bug from other disk exhaustion issues, but contributes to the same family of problems:

  • #24207 — No disk space management, ~/.claude grows unbounded
  • #16093 — Infinite logging loop in debug files (200GB+)
  • #10107 — File-history self-referencing causes 300GB disk exhaustion
  • #20261 — Background task output files persist
  • #19317 — Background agents/tasks not cleaned up

## Session Details

  • Session ID: e64f2294-c245-4089-9b90-059e83d75927
  • Project: chaintrust-python-sdk
  • Branch: feat/sdk-organizations-billing-dashboard
  • Sub-agents spawned: a1689fc, a26810f, a6d9aab, a96152c
  • Parent task: b4985d6
  • Timestamp: 2026-02-19 20:05–20:11 UTC

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗