claude-code - 💡(How to fix) Fix [BUG] Subagent task output not size-capped, single session filled 569GB on disk [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47771Fetched 2026-04-15 06:42:50
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

Error Messages/Logs

Root Cause

A single Claude Code session consumed 569GB of disk space in /private/tmp/claude-501/<project>/<session-id>/tasks/ because subagent .output files are not size-capped. Three subagents each wrote ~190GB files (196GB, 187GB, 186GB) to disk in under 24 hours, nearly filling a 1TB SSD.

Code Example

Subagent output files grow unbounded until disk is nearly full. No warning or cap is enforced.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

A single Claude Code session consumed 569GB of disk space in /private/tmp/claude-501/<project>/<session-id>/tasks/ because subagent .output files are not size-capped. Three subagents each wrote ~190GB files (196GB, 187GB, 186GB) to disk in under 24 hours, nearly filling a 1TB SSD.

Root cause: subagents ran npm start on an Azure Functions project, which invokes func start. Without --worker-runtime specified, func prompts interactively: "Select a number for worker runtime: Choose option:". Subagents have no stdin/TTY, so func loops infinitely re-printing "Choose option:". The subagent output buffer has no size cap, so Claude Code wrote billions of repeated prompts to disk until the SSD was nearly full.

Impact: macOS reported 776GB as "System Data" in Storage settings. I had 2GB free when discovered. Content of output files confirmed to be the string "Choose option: " repeated until the file hit 210,664,984,575 bytes.

What Should Happen?

Subagent output should be capped at a reasonable size (e.g. 10-100MB). When the cap is hit, the subagent process should be terminated and reported as failed. Ideally, interactive-prompt detection would fail the subagent early when stdin is unavailable.

Error Messages/Logs

Subagent output files grow unbounded until disk is nearly full. No warning or cap is enforced.

Steps to Reproduce

  1. Have a project with an Azure Functions backend where package.json has "start": "func start" (no --worker-runtime flag)
  2. Open Claude Code in that project
  3. Ask Claude to run or test the backend such that it spawns Task subagents to execute npm start
  4. Subagents hang indefinitely on the interactive "Choose option:" prompt
  5. Observe /private/tmp/claude-501/<project>/<session>/tasks/*.output files grow without bound

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

v2.1.98

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The issue can be fixed by capping the subagent output size and terminating the subagent process when the cap is hit, or by specifying the --worker-runtime flag to avoid interactive prompts.

Guidance

  • Identify the Azure Functions projects in the Claude Code setup and modify the package.json to include the --worker-runtime flag when running func start, to prevent interactive prompts.
  • Implement a size cap for subagent output files, such as 10-100MB, to prevent unbounded growth.
  • Consider adding detection for interactive prompts and fail the subagent early when stdin is unavailable.
  • Review the Claude Code configuration to ensure that subagent output is properly handled and capped.

Example

No code snippet is provided as the issue is more related to configuration and setup.

Notes

The issue is specific to Azure Functions projects with interactive prompts, and the fix should be applied to those projects. The exact implementation of the size cap and interactive prompt detection may vary depending on the Claude Code setup and requirements.

Recommendation

Apply a workaround by specifying the --worker-runtime flag in the Azure Functions projects to avoid interactive prompts, as this is a more straightforward solution that can be implemented immediately.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Subagent task output not size-capped, single session filled 569GB on disk [1 comments, 2 participants]