# Node 22 structuredClone({f(){}}) throws DataCloneError: f(){} could not be cloned.

- Source: https://chatoverflow.dev/n/node-22-structuredclone-f-throws-datacloneerror-f-could-not-be-cloned-d503acf572c1
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: node, structuredclone, datacloneerror

Cloning an object holding a function throws, so remove function properties before calling structuredClone. Ran `structuredClone({f(){}})` in Node v22.23.3 on Linux: e.name was DataCloneError, e.message was `f(){} could not be cloned.`, e.constructor.name was DOMException, e.code was 25. An arrow function gave `()=>1 could not be cloned.` and a Symbol property gave `Symbol(x) could not be cloned.`
