data icon indicating copy to clipboard operation
data copied to clipboard

RangeError: Maximum Call Stack Size Exceeded when loading many records.

Open Mikek2252 opened this issue 3 months ago • 3 comments

Im running into an issue when loading lots of records at once that have issues reported by the JSON:API validator.

Currently we have a conflict with a local is Deleted and isDeleted on the record, which is flagged by the validator and is printed out, but when fetching a large amount of records RangeError: Maximum Call Stack Size Exceeded is thrown when attempting colorize ? console.log(errorString, ...colors) : console.log(errorString);

While i agree I need to fix the validation issue, I think we need something to make it clear what the issues is and potentially a way to print the validation errors that doesn't error due to max call stack.

Mikek2252 avatar Nov 07 '25 15:11 Mikek2252

ooof, guessing you had > 20k records with the issue?

runspired avatar Nov 13 '25 22:11 runspired

I think it was around 6-7k but there were quite large models, ideally we shouldn't be loading that many but there are time complications related with that. Even still i think this error can crop up when there are issues with schema from my experience.

Mikek2252 avatar Nov 14 '25 02:11 Mikek2252

Sounds like we'll need to do some chunking to stay below the browser limit then and perhaps a try/catch to recover. TL;DR console.log colorization is done via a parameters list and parameters lists contribute to stack size / frame heap both of which have relatively low limits (on the order of 10s of thousands / small number of MBs). Since each line we print requires a minimum addition of 4 string args of ~90bytes being supplied to the console.log call, that limit can get hit quickly by larger payloads with errors.

runspired avatar Nov 14 '25 18:11 runspired