Passing array though port causes error on macOS

Good morning, I am having a frustrating and unique issue. I am using Elm as the renderer in an electron application. Everything works fine on Linux and Windows, but on macOS, I get an error when I try and send an array through a port.

My application is a font viewer called FontFinder I made for my wife to be able to view all of the thousands of fonts on her computer. I ran into this issue when fixing the menu for macOS on branch fix-macos.

The error occurs at this point:

  • main.js [107]: send “ELM-EVENT” {port: "receiveFonts", args: [...array of fonts]} to renderer.js
  • renderer.js [16]: receive event call send for port “receiveFonts” and send args
  • Trying to send an unexpected type of value through port “receiveFonts”: [object Object]


  • Mac mini (Late 2014) running macOS Big Sur 11.1


  • Node 15.5.1
  • npm 7.3.0
  • Elm 0.19.1
  • Electron 11.1.1

Recreate the issue:

  • Download the repository
  • git checkout fix-macos
  • npm ci
  • npm start
  • After the application starts the error will be in the DevTools window.

Thank you for reading,
I would really appreciate some help with this issue.

With the help of @MartinS on the Elm slack, we determined the problem lies in the list being sent to the Elm app. The list contained an undefined, causing the error.


Ports errors can be hard to solve. Sometimes one way of figuring it out is to retrieve a Json.Decode.Value directly and build a decoder for it. Then you can get better errors from the decoder.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.