node
runtime_error
ai_generated
true
RangeError: Maximum call stack size exceeded
ID: node/maximum-call-stack
90%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
Infinite recursion or deeply nested function calls. Common in recursive algorithms without base case.
genericWorkarounds
-
95% success Check recursive function for missing or incorrect base case
Check recursive function for missing or incorrect base case
Sources: https://developer.mozilla.org/en-US/docs/Glossary/Recursion
-
90% success Convert recursive algorithm to iterative with explicit stack
const stack = [initial]; while (stack.length) { const item = stack.pop(); ... }Sources: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration
-
85% success Check for circular references in objects being JSON.stringify'd or deep-cloned
Check for circular references in objects being JSON.stringify'd or deep-cloned
Sources: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
Dead Ends
Common approaches that don't work:
-
Increase Node stack size with --stack-size
80% fail
Just delays the crash — infinite recursion will still overflow
-
Convert to setImmediate/setTimeout recursion
60% fail
May work but creates memory leaks and is very slow
Error Chain
Frequently confused with: