You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A RangeError that is not a stack overflow is reported as one #2120
book_err (bend2/main.ts:1121) reports every RangeError as a stack overflow:
if(einstanceofRangeError){return"Error: the machine stack overflowed (a deep recursion, or a"+" literal too large to expand)";}
JSC throws RangeError for more than a full stack: Out of memory (a failed string or array allocation), Invalid array length, Maximum BigInt size exceeded, an out-of-range toFixed or String.prototype.repeat, and others. All of these print as "the machine stack overflowed", and the original message is lost.
This hid the cause in #2076's second comment. Bend 2.0.40 failed on Entangle's tools/verify-mesh-window.bend with this message under the release's Bun 1.3.14, and passed under 1.4.4. That build ran under 2.0.40's memory blowup (8.4 GB on glam-in-bend's kernel.bend, the same under Bun 1.3.14 and 1.4.0), so an Out of memoryRangeError is as likely as a deep recursion. The message doesn't say which it was. On macOS, 1.3.14 also recurses as deep as 1.4.0 (about 59K plain frames against 53K), so a smaller stack isn't an obvious explanation.
Expected: only a stack overflow (Maximum call stack size exceeded) prints the stack message. Any other RangeError prints its own message, for example Error: RangeError: Out of memory.
Confirmed on the case from #2076. Bend 2.0.40 printed "the machine stack overflowed" on Entangle's tools/verify-mesh-window.bend. The actual error, printed through a patched book_err, was:
RangeError: Out of memory
at memo (bend2/comp.ts:1694:7)
It was Map.set on the FL.ground cache. Bun 1.3.14 caps a Map at 25,165,824 entries (Bun 1.4.0 at 50,331,648), and 2.0.40 never cleared that cache. The stack message sent the report after stack sizes, which could not help.
The fix proposed above would have printed Error: RangeError: Out of memory, and that points straight at the cache. The case itself is fixed on main (#2107). This issue is only about the message.
Activity
nicolas-abril commentedon Nov 10, 2026
Confirmed on the case from #2076. Bend 2.0.40 printed "the machine stack overflowed" on Entangle's
tools/verify-mesh-window.bend. The actual error, printed through a patchedbook_err, was:It was
Map.seton theFL.groundcache. Bun 1.3.14 caps aMapat 25,165,824 entries (Bun 1.4.0 at 50,331,648), and 2.0.40 never cleared that cache. The stack message sent the report after stack sizes, which could not help.The fix proposed above would have printed
Error: RangeError: Out of memory, and that points straight at the cache. The case itself is fixed onmain(#2107). This issue is only about the message.fix(cli): match a stack overflow by RangeError and message start, in …
fix(cli): only a stack overflow prints the stack overflow message (be…