RangeError JavaScript Origin: On your device Last updated 8 Oct 2026

RangeError: Maximum call stack size exceeded

A function called itself (directly or indirectly) too many times — usually infinite recursion.

Exact message you may see Maximum call stack size exceededtoo much 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

  1. Look at the repeating frames in the stack trace
  2. Add/fix the base case of the recursion
  3. In setters, store into a different backing field (this._value)
  4. Convert deep recursion into an iterative loop

Detailed fix by platform

JavaScript

  1. 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

  1. Stack — Which functions repeat?
  2. Base case — Does recursion ever stop?
  3. Side effects — Do handlers trigger each other?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

JsonException object cycle — JsonException: A possible object cycle was detected (.NET)JsonException object …Maximum function nesting — Fatal error: Maximum function nesting level of '256' reached, aborting! (PHP)Maximum function nest…OutOfMemoryError — java.lang.OutOfMemoryError: Java heap space (Java)OutOfMemoryErrorPage Unresponsive — Chrome: Page Unresponsive — The following page(s) have become unresponsive. You can wait for them to become responsive or exit the page(s) (Browser)Page Unresponsiverecursion limit — Msg 530: The statement terminated. The maximum recursion 100 has been exhausted before statement completion. / MySQL 3636 Recursive query aborted after 1001 iterations (SQL)recursion limitRecursionError — RecursionError: maximum recursion depth exceeded (Python)RecursionErrorSIGSEGV — Segmentation fault (core dumped) (Linux)SIGSEGVStack overflow — .NET: Stack overflow. / Process is terminated due to StackOverflowException (.NET)Stack overflowRangeError

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.