structuredClone() can't clone functions, class instances with non-plain internals, or objects holding open handles — it only supports the structured clone algorithm's data types. Strip the object down to plain, clonable data first, or write a manual serialization step for the parts that don't qualify.