[BUG] subagent call subagent cause memory overflow

Resolved 💬 3 comments Opened Dec 10, 2025 by towry Closed Dec 10, 2025

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?


⏺ I understand you need to test your overflow prevention hook. Let me proceed with spawning a subagent inside another subagent to test it.

  sage(Search for "ci" in codebase and spawn internal subagent) opencodeai/big-pickle
  ⎿  Running PreToolUse hook…
  ⎿  total 72
     eng(Analyze CI references in dotfiles codebase)
     +11 more tool uses (ctrl+o to expand)
     ctrl+b to run in background

✻ Scheming… (esc to interrupt · 1m 29s · ↓ 170 tokens)

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

<--- Last few GCs --->

[33482:0xad940c000]   237727 ms: Mark-Compact 4042.8 (4131.9) -> 4035.7 (4140.9) MB, pooled: 0 MB, 652.25 / 0.00 ms  (average mu = 0.439, current mu = 0.280) allocation failure; scavenge might not succeed
[33482:0xad940c000]   238880 ms: Mark-Compact 4051.6 (4140.9) -> 4041.7 (4146.9) MB, pooled: 0 MB, 1133.00 / 0.00 ms  (average mu = 0.220, current mu = 0.017) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0x10488834c node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/nix

What Should Happen?

Subagents should not nesting subagent

Error Messages/Logs

Steps to Reproduce

  1. create a subagent
  2. prompt: "Please call subagent X and ask it to call subagent Y"

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.61 (Claude Code)

Platform

Other

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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