DataCloneError: Failed to execute 'postMessage' on 'Worker': [object Array] could not be cloned

How to solve this problem!
An error occurred while rendering. Rendering has stopped.
DataCloneError: Failed to execute ‘postMessage’ on ‘Worker’: [object Array] could not be cloned.

Error: Failed to execute ‘postMessage’ on ‘Worker’: [object Array] could not be cloned.
at runTask (http://localhost:5173/map/node_modules/.vite/deps/cesium.js?v=859da5c5:26325:21)
at async scheduleTask (http://localhost:5173/map/node_modules/.vite/deps/cesium.js?v=859da5c5:26339:20)

Hi @guanzheyuan, would you be able to describe how you’ve configured your app?

For instance, here’s the suggested workflow for using CesiumJS with vite.

I’ve solved this problem thanks a lot

2 Likes

Hi @guanzheyuan,
I also have the same error as above, can you share with me how to solve it?

1 Like

I have encountered the same issue and really need your assistance.
Thanks a lot!

1 Like

I also encountered this issue when implementing a mouse movement feature to select a model entity drawn on a map. Please let me know how you solved it. Thank you so much.

1 Like

Does anyone know how to fix this error?

3 Likes

Anyone here for help?

There are several answers here that talk about this error. But none of them provides sufficient detail to even make profound guesses about the reason for the error - and even less, for possible solutions.

So I’ll start with a guess that’s based on the CesiumJS code, and totally unrelated to issues that people might have with their setup: Is anybody, by any chance, creating and adding a Primitive with something like

scene.primitives.add(new Cesium.Primitive({
    ...
});

there?

If so, try out passing asynchronous: false in like this:

scene.primitives.add(new Cesium.Primitive({
    ...
    asynchronous: false
});

If that’s not it, there are only a few hundred left.

3 Likes

Hi Marco,

Thanks very much for your response.

My issue is that when we use the function scene.pick or scene.drillPick during the mouse moving, those “Worker” errors occurred. That means the picking function is called too much at the short time.

If I remove that mouse hover event or not using scene.pick, scene.drillPick, no issue happens however that’s our fundamental function which cannot be excluded.

Some ideas such as using throttle, debounced to reduce the actions however it’s not only not resolving the problems but also making our features working incorrectly.

So, please kindly share with me any other idea to resolve this issue if you have.

That would be much appreciated!

Thanks once again, Marco!

2 Likes

There seems to be a problem that affects multiple people. But until now, I did not see a reasonable way to reproduce the error. If you can provide a https://sandcastle.cesium.com/ where you can call drillPick and see the error, then it might be possible to analyze that and figure out what is wrong.

Or to put it that way: The Sandcastle at Cesium Sandcastle already does use drillPick, and it works. So we have to figure out what is different compared to the case where the error appears.

1 Like