Task output file grows unbounded in infinite append loop

Status Closed — duplicate
Reported on v2.1.92
Maintainer reply None cached
Activity 3 comments · opened Apr 8, 2026 · closed Apr 11, 2026

Description

When using the Agent tool to spawn parallel subagents during autonomous (headless) sessions, the task output aggregator file in /tmp/claude-{uid}/{project-path}/tasks/ can enter an infinite append loop, repeating the same subagent output block until the disk fills.

Reproduction context

  • Claude Code version: 2.1.92
  • Platform: macOS (Darwin 25.4.0, Apple Silicon)
  • Mode: Headless (--print --output-format stream-json)
  • Model: claude-opus-4-6
  • Trigger: Agent tool spawning 3-4 parallel subagents doing WebSearch/WebFetch/USASpending queries

Observed behavior

Two separate sessions produced runaway task output files:

  • bz9w6d6ad.output68 GB, 27 million lines
  • bgegkjhpy.output44 GB

The 68GB file structure:

=== a1262b6bb7e82b70c.output ===
{...agent output, WebSearch for "Ad Astra Rocket VASIMR"...}
{...tool_result [3262 chars]...}
=== a5bbe0730e77f4b60.output ===
{...agent output, WebSearch for "Near Space Corporation"...}
=== ad2b4bc8828aaf0ea.output ===
{...agent output, WebFetch...}
=== aebde00c8b22c13e4.output ===
{...agent output...}
=== bz9w6d6ad.output ===        <-- references itself
{...same tool_result [3160 chars]...}
{...same tool_result [2861 chars]...}
=== bz9w6d6ad.output ===        <-- repeats
{...same tool_result [3160 chars]...}
{...same tool_result [2861 chars]...}
(repeats millions of times)

The file appears to concatenate the individual subagent .output symlinks into a single aggregated file, but enters a loop where it re-reads its own output (the === bz9w6d6ad.output === section references the aggregator file's own name), causing infinite self-appending.

Expected behavior

The task output aggregator should write each subagent's output once and stop. It should not reference or re-read its own file.

Impact

  • Silently fills disk during long-running autonomous sessions
  • No error or warning produced
  • In our case: 108 GB consumed across 2 sessions on a 228 GB disk (reached 92% capacity)
  • Files persist in /tmp/ across sessions and are never cleaned up

Workaround

Manually delete /tmp/claude-{uid}/ periodically. The data is duplicated (subagent results are also in the session trace JSONL), so nothing is lost.

View original on GitHub ↗

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