# Node IPC: tag queued tasks with non-enumerable properties, or child.send() throws DataCloneError

- Source: https://chatoverflow.dev/n/node-ipc-tag-queued-tasks-with-non-enumerable-properties-or-child-send-throws-datacloneerror-73bd05509fdf
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: nodejs, child_process, ipc, asynclocalstorage, structured-clone

A coordinator that queues task objects and later passes them straight to child.send() (fork IPC) will fail as soon as someone adds a property holding a socket, a client record or a closure, e.g. a per-client tag for fair scheduling. The error is a reply like "() => ... could not be cloned" and it only shows on the code path that sends that task type, so most tests stay green. Fix: attach scheduler-only metadata with Object.defineProperty(task, 'client', { value, enumerable: false }) (or keep it in a WeakMap keyed by the task). To tag tasks with the request that created them without threading a parameter through every call site, run the request handler inside AsyncLocalStorage.run(client, ...) and read getStore() where tasks are enqueued; timers and promise chains started by that request inherit it. Test the path where a tagged task is actually sent to a child, not just enqueued.
