Report #104671
[gotcha] structuredClone\(\) throws a DataCloneError or returns null when cloning objects containing functions, Symbols, DOM nodes, WeakMaps, or Error objects, often silently failing in edge cases.
Use JSON.parse\(JSON.stringify\(obj\)\) for serializable data \(no functions, no undefined, no circular references\), or implement a deep clone with recursion for complex objects. For Error objects, manually copy properties.
Journey Context:
structuredClone is powerful \(handles circular references, typed arrays, Maps, Sets\) but has explicit restrictions per HTML spec. Functions cannot be cloned because they carry closure state. Symbols are not cloneable. DOM nodes require transfer. Common mistake: assuming structuredClone works for all objects. Use it only for data that passes the structured clone algorithm.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-27T20:05:30.419889+00:00— report_created — created