[BUG] Deeper subagent call trigger OOM

Resolved 💬 5 comments Opened Dec 24, 2025 by complyue Closed Feb 17, 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 subagent decides to call itself as a nested subagent, CC crashes for certain.

⏺ Now let me refactor the e2e-test-helper.js to use the new APIs:

⏺ coder(Refactor e2e-test-helper.js)
  ⎿  > Refactor `/ws/AiWorks/longrun-ai/dominds/webapp/static/testing/e2e-test-helper.js` to use the new component APIs and DOM observation utilities.
     coder(Refactor e2e-test-helper.js)
     ctrl+b to run in background

✻ Refactoring e2e-test-helper.js… (esc to interrupt · ctrl+t to show todos · 7m 25s · ↓ 10.7k tokens · thinking)
  ⎿  Next: Code review by code-reviewer subagent

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)                                                                                                   ⧉ In subdialog.md

<--- Last few GCs --->

[60514:0x7fec18008000]  1000464 ms: Scavenge (interleaved) 4038.8 (4118.7) -> 4035.3 (4136.7) MB, pooled: 0 MB, 21.83 / 0.00 ms  (average mu = 0.436, current mu = 0.332) allocation failure; 
[60514:0x7fec18008000]  1002453 ms: Mark-Compact 4048.9 (4136.9) -> 4039.9 (4144.2) MB, pooled: 0 MB, 1925.54 / 0.00 ms  (average mu = 0.311, current mu = 0.146) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

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

 1: 0x10c6d36d4 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 2: 0x10c8ca998 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 3: 0x10caf03b7 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 4: 0x10caee50f v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 5: 0x10cae1135 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 6: 0x10cae1a44 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 7: 0x10cac2fd3 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 8: 0x10cf61adb v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 9: 0x10d46ce36 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
10: 0x117c60ee9 
zsh: abort      claude --dangerously-skip-permissions

What Should Happen?

It should run normally, or as a workaround, prevent subagent from calling (itself or other) subagent.

Error Messages/Logs

⏺ Now let me refactor the e2e-test-helper.js to use the new APIs:

⏺ coder(Refactor e2e-test-helper.js)
  ⎿  > Refactor `/ws/AiWorks/longrun-ai/dominds/webapp/static/testing/e2e-test-helper.js` to use the new component APIs and DOM observation utilities.
     coder(Refactor e2e-test-helper.js)
     ctrl+b to run in background

✻ Refactoring e2e-test-helper.js… (esc to interrupt · ctrl+t to show todos · 7m 25s · ↓ 10.7k tokens · thinking)
  ⎿  Next: Code review by code-reviewer subagent

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)                                                                                                   ⧉ In subdialog.md

<--- Last few GCs --->

[60514:0x7fec18008000]  1000464 ms: Scavenge (interleaved) 4038.8 (4118.7) -> 4035.3 (4136.7) MB, pooled: 0 MB, 21.83 / 0.00 ms  (average mu = 0.436, current mu = 0.332) allocation failure; 
[60514:0x7fec18008000]  1002453 ms: Mark-Compact 4048.9 (4136.9) -> 4039.9 (4144.2) MB, pooled: 0 MB, 1925.54 / 0.00 ms  (average mu = 0.311, current mu = 0.146) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

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

 1: 0x10c6d36d4 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 2: 0x10c8ca998 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 3: 0x10caf03b7 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 4: 0x10caee50f v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 5: 0x10cae1135 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 6: 0x10cae1a44 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 7: 0x10cac2fd3 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 8: 0x10cf61adb v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
 9: 0x10d46ce36 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/cyue/.nvm/versions/node/v22.16.0/bin/node]
10: 0x117c60ee9 
zsh: abort      claude --dangerously-skip-permissions

Steps to Reproduce

Define a subagent, manage to call it to call itself as a deeper nested subagent.

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.76

Platform

Other

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Seems like regression from #4850 ?

View original on GitHub ↗

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