It looks like there's a period during MSFS startup where the API is connected, but it can't actually be used to make any calls yet, leading to console errors:
are-we-flying>node api-server.js
ALOS loaded, using 23965 tiles.
resetting autopilot
Server listening on http://localhost:8080
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
authenticating client
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Can't connect to MSFS, retrying in 5 seconds
Connected to MSFS.
Registering API server to the general sim events.
RecvException { exception: 3, sendId: 11, index: 3 }
RecvException { exception: 3, sendId: 17, index: 3 }
RecvException { exception: 3, sendId: 22, index: 3 }
RecvException { exception: 3, sendId: 27, index: 3 }
RecvException { exception: 3, sendId: 32, index: 3 }
<at this point MSFS is properly up and running and the exceptions stop>
It looks like there's a period during MSFS startup where the API is connected, but it can't actually be used to make any calls yet, leading to console errors:
The exception here is SIMCONNECT_EXCEPTION_UNRECOGNIZED_ID