Native messaging webextensions-examples errors

I am trying to run this web extension: https://github.com/mdn/webextensions-examples/tree/main/native-messaging around native-messaging on linux and macOs but it fails with an error: ‘Error: Attempt to postMessage on disconnected port’.

The error is undocumented.
And it does not make sense as it says that something have happened but not why it happened and also, it does not provide any additional information to help debug it.

It looks like it gets disconnected before it hits the ‘postMessage’ function but the error on the ‘onDisconnect’ event listener is ‘null’.

Does anyone know what this means or how to debug it?

(unrelated to this, but related to ambiguous errors and lack of documentation: prior to this error I had to deal with one that was saying ‘Error: An unexpected error occurred’ which turned to be an incorrect path in the firegem.json file)

this bug looks related: https://bugzilla.mozilla.org/show_bug.cgi?id=1465514