Error stacks S1
- Stage: Stage 1
- Status: Active
- ECMAScript edition: —
- Synchronized: Aug 28, 2026
- 中文译文 · Source repository
The proposal standardizes the de facto Error.prototype.stack property, addressing security concerns around improper standardization. It catalogs existing implementations across V8, Safari, and Firefox, and proposes an Annex B specification.
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
Error Stacks
ECMAScript Proposal, specs, and reference implementation for Error.prototype.stack/System.getStack/System.getStackString
Spec drafted by @ljharb along with @erights.
This proposal is currently stage 1 of the process.
Rationale
Errors have never had a stack trace attached in the language spec — however, implementations have very consistently provided one on a property named “stack” on instantiated Error objects. There has long been concern about standardizing stack traces improperly - such that implementations could not claim to be fully compliant while also providing security guarantees. This proposal is an attempt to standardize the intersection of existing browser behavior, in a way that addresses these security concerns.
Compatibility
V8 in Node 7-20 and Chrome 54-114: stack is an own property on Error instances which claims to be a value property ({"value":"(stack here)","writable":true,"enumerable":false,"configurable":true), but V8's Error has exotic behavior for [[GetOwnProperty]] that acts like a getter the first time (if there's been no set first) by triggering prepareStackTrace and setting stack, as discussed in this thread. After that, it behaves like a standard value property.
V8 in Node <= 6 and Chrome <= 53, and Node >= 21 and Chrome >= 115: stack is an own property on Error instances with a getter/setter: { configurable: true, enumerable: false }
- The getter returns
undefinedwith a non-Error receiver, and returns thestackproperty (whatever its current value may be) otherwise. - The setter is a no-op with a non-Error object receiver, and sets the return of the
stackgetter otherwise.
Safari: stack is an own string data property on Error instances: { configurable: true, enumerable: false, writable: true }
Firefox: stack is an own property on Error.prototype: { configurable: true, enumerable: false }
- The getter throws on a non-Error receiver, and returns the original stack trace otherwise.
- The setter sets the
stackproperty on a non-Error receiver, and is a no-op on an Error receiver.
Naming
Error.prototype.stack is set in stone - this is a defacto reality, and will be implemented in Annex B.
Spec
You can view the spec rendered as HTML.