Skip to content

Fix: Configure 8GB Node.js heap for Claude CLI to prevent OOM errors #150

Description

@rysweet

Problem Description

Claude CLI (claude/claude-trace) processes encounter "out of memory" errors during execution, causing failures on large codebases or complex operations.

Error Example

<--- Last few GCs --->
[12980:0x148008000] 94508806 ms: Scavenge (interleaved) 3198.3 (3230.8) -> 3198.3 (3230.8) MB
[12980:0x148008000] 94512102 ms: Mark-Compact 4090.2 (4122.7) -> 4086.0 (4137.1) MB

<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Root Cause

Node.js default heap size (1.4-1.7 GB) is insufficient for Claude CLI's memory requirements during intensive operations.

Solution

Set NODE_OPTIONS environment variable to allocate 8GB heap memory before launching claude/claude-trace processes.

Requirements

  • Set NODE_OPTIONS=--max-old-space-size=8192 (8GB) before launching Claude
  • Apply to both launch() and launch_interactive() methods in ClaudeLauncher
  • Ensure environment variable is passed to subprocess

Success Criteria

  • Environment variable set in both launch methods
  • Value is exactly 8GB (8192 MB)
  • No more OOM errors on previously failing operations
  • Manual testing verification

Labels

  • bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions