GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — MessagePort: messageerror event - Web APIs | MDN

MessagePort: messageerror event

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2023.

  • See full compatibility
  • Learn more

Note: This feature is available in Web Workers.

The messageerror event is fired on a MessagePort object when it receives a message that can't be deserialized.

This event is not cancellable and does not bubble.

Syntax

Use the event name in addEventListener():

js
addEventListener("messageerror", (event) => { })

Alternatively, assign to the event handler property of the interface:

js
onmessageerror = (event) => { }

Event type

A MessageEvent. Inherits from Event.

Examples

Attempting to share memory

A common cause of messageerror events is attempting to send a SharedArrayBuffer object, or a buffer view backed by one, across agent clusters. For example, a window is not in the same agent cluster as a shared worker it created, so suppose the page runs the following code:

js
const worker = new SharedWorker("worker.js");
worker.port.start();
worker.port.addEventListener("message", (event) => {
  worker.port.postMessage(new SharedArrayBuffer(1024));
});

And worker.js contains the following code:

js
self.addEventListener("connect", (event) => {
  console.log("Hello");
  const port = event.ports[0];
  port.start();
  port.postMessage("Port connected");
  port.addEventListener("messageerror", (event) => {
    console.log("Message error");
  });
});

Then the shared worker will receive a messageerror event when it tries to deserialize the message sent from the window.

Note: You can use browser devtools to debug your SharedWorker, by entering a URL in your browser address bar to access the devtools workers inspector; for example, in Chrome, the URL chrome://inspect/#workers, and in Firefox, the URL about:debugging#workers.

Specifications

Specification
HTML
# event-messageerror
HTML
# handler-messageeventtarget-onmessageerror

Browser compatibility

See also

  • Related events: message.
  • Using channel messaging

Help improve MDN

Learn how to contribute

This page was last modified on Oct 26, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.