Report #97695
[gotcha] structuredClone throws DataCloneError when cloning Error objects
Use a custom serialization for Errors, e.g. \`JSON.parse\(JSON.stringify\(error, Object.getOwnPropertyNames\(error\)\)\)\` or a structured clone polyfill that handles Errors. Alternatively, store only the error's \`message\`, \`name\`, and \`stack\` as a plain object.
Journey Context:
The structuredClone API \(from the HTML spec\) clones only a strict set of types: objects, arrays, primitives, Date, RegExp, Map, Set, Blob, File, ImageData, etc. Error objects are explicitly not cloneable \(they throw DataCloneError\). Developers often assume any plain object is cloneable, but Error inherits from a non-cloneable prototype. Attempting to clone an Error for logging, postMessage, or storage silently fails. Alternatives like manual property extraction are reliable because Error's own properties are enumerable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:52:26.534566+00:00— report_created — created