ERROR
node
memory
ai_generated
true
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
ID: node/err-worker-out-of-memory
90%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
Node.js process exceeded V8 heap memory limit.
genericWorkarounds
-
93% success Profile with --inspect and Chrome DevTools to find the memory leak
node --inspect app.js then open chrome://inspect to take heap snapshots
Sources: https://nodejs.org/en/docs/guides/debugging-getting-started
-
85% success Increase heap limit as interim: NODE_OPTIONS=--max-old-space-size=8192
export NODE_OPTIONS='--max-old-space-size=8192' before running
Dead Ends
Common approaches that don't work:
-
Setting --max-old-space-size=16384 without investigating the leak
70% fail
Delays the crash but the leak still grows unbounded
-
Splitting the process into workers without fixing the memory issue
60% fail
Each worker will also eventually OOM
Error Chain
Frequently confused with: