The messageerror event on a Worker fires when it receives a message that can’t be deserialized (MDN). Listen with addEventListener("messageerror", …) or the onmessageerror property.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Three different failures. Success, decode fail, script crash.
Healthy ping → message. Normal postMessage.
Throw → error. Not messageerror.
Know each channel. Don’t treat all failures the same.
Compatibility
Browser Support
The Workermessageerror event has Limited availability on MDN (not Baseline). Feature-detect before relying on it.
✓ Limited availability
Worker messageerror event
Supported in modern Chromium and Firefox-family browsers; check Safari/legacy carefully. Fires when a worker message cannot be deserialized.
72%Browser support
Google Chromemessageerror · supported
Full support
Microsoft Edgemessageerror · Chromium
Full support
Mozilla Firefoxmessageerror · supported
Full support
Operamessageerror · Chromium
Full support
Apple Safaricheck version
Partial / check
Internet Explorernot supported
No support
Worker messageerrorLimited
Bottom line: Always feature-detect. Prefer cloneable payloads so decode failures stay rare. Pair with message and error handlers.
Frequently Asked Questions
It fires on the Worker object when it receives a message that cannot be deserialized (MDN). Listen with worker.onmessageerror or worker.addEventListener("messageerror", handler).
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It has Limited availability (not Baseline), so feature-detect. Available in Web Workers except Service Workers.
message means a reply arrived and decoded successfully (read event.data). messageerror means a message arrived but could not be deserialized—so you do not get a usable payload the normal way.
error means the worker script failed (throw, load failure, and similar). messageerror is specifically about failing to deserialize an incoming message, not about the worker script crashing.
No. Per MDN, this event is not cancellable and does not bubble.
Everyday cloneable values (strings, numbers, plain objects, arrays) deserialize fine. messageerror is for rarer deserialize failures. Labs focus on attaching handlers, feature detection, and contrasting related events.