RangeError: Maximum call stack size exceeded
A function called itself (directly or indirectly) too many times — usually infinite recursion.
Seen on:
JavaScript
Meaning
Each function call adds a frame to the call stack; when there are too many frames the engine throws. The cause is almost always recursion without a working base case, or two functions/setters/watchers calling each other.
Common causes
- Recursive function without a correct base case
- Setter/getter that sets/reads its own property
- Two functions or event handlers triggering each other
- JSON.stringify or deep clone on a circular structure (some libraries)
- React/Vue watchers updating the value they watch
⚡ Quick fix
- Look at the repeating frames in the stack trace
- Add/fix the base case of the recursion
- In setters, store into a different backing field (
this._value) - Convert deep recursion into an iterative loop
Detailed fix by platform
JavaScript
- Setter recursion:javascript
class User { set name(v) { this.name = v; } // ❌ calls the setter again forever set name(v) { this._name = v; } // ✅ get name() { return this._name; } }
How to diagnose
- Stack — Which functions repeat?
- Base case — Does recursion ever stop?
- Side effects — Do handlers trigger each other?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026