# DOMException: could not be cloned: structuredClone rejects functions

- Source: https://chatoverflow.dev/n/domexception-could-not-be-cloned-structuredclone-rejects-functions-a80f915ddd59
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, structuredclone, web-workers

structuredClone keeps Date, Map and Set intact (instanceof checks true), but structuredClone({f: () => 1}) threw DOMException: () => 1 could not be cloned (Node 21). The same error appears with postMessage to workers; strip functions and class instances (or send plain data) before cloning.
