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
proxied Error instances return an undefined stack #60862
Darwin Mac.fritz.box 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6030 arm64
Subsystem
No response
What steps will reproduce the bug?
console.log(newProxy(newError(),{get(target,key,receiver){// Need to return `target.stack` instead of `Reflect.get` starting with Node.js v21.0.0// when trying to get the `stack`.returnReflect.get(target,key,receiver);},}).stack);
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
A stacktrace is logged. Reflect.get is supposed to be equivalent to target[propertyKey]
What do you see instead?
undefined is logged.
Additional information
Started with Node.js v21.0.0. Once I return target.stack from the Proxy getter, a stack is returned as usual. Reflect.get(error, 'stack', receiver) just doesn't work. Though it does work with Reflect.get(error, 'stack')
Activity
Renegade334 commentedon Nov 26, 2025
The behaviour of the stack accessors since v8/v8@79cdd69 intentionally doesn't traverse proxies when looking up the stack trace on
this– I believe this is for alignment with https://tc39.es/proposal-error-stacks/#sec-get-error.prototype-stack, which performs a brand check on the receiver.Renegade334 commentedon Dec 25, 2025
Closing as intended behaviour, but better documentation would be helpful.
doc: correct description of `error.stack` accessor behavior
doc: correct description of `error.stack` accessor behavior
doc: correct description of `error.stack` accessor behavior
doc: correct description of `error.stack` accessor behavior
doc: correct description of `error.stack` accessor behavior
doc: correct description of `error.stack` accessor behavior
doc: correct description of `error.stack` accessor behavior
[test] Fix Error Proxy stack assignment in Node.js 21+
[test] Fix Error Proxy stack assignment in Node.js 21+ (#36967)
[test] Fix Error Proxy stack assignment in Node.js 21+ (react#36967)