Uncaught Rangeerror: Maximum Call Stack Size Exceeded With Bootbox.confirm

Hello! I have a confirmation window that works but when I change it to bootbox.confirm it throws an "Uncaught RangeError: Maximum call stack size exceeded" error. Sometimes it even stops. Note that I am calling the confirm window from a modal. Thank you!

This error is almost always means you have a problem with recursion in JavaScript code, as there isn’t any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited.

How to fix

Wrap your recursive function call into a -

  • setTimeout
  • setImmediate or
  • process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately. Moreover, you can managed to find the point that was causing the error by check the error details in the Chrome dev toolbar console , this will give you the functions in the call stack, and guide you towards the recursion that’s causing the error.