Quick answer: GameMaker Async Networking event firing for a socket that hasn't completed handshake? Connection isn't synchronous; first events may indicate handshake progress - check async_load[? 'type'].

Send RPC immediately on socket create; receives error in async; assumed it was the RPC's response.

Wait for connection state

Listen for network_type_connect; only then send RPC.

Or queue early sends

Queue RPCs before connect; flush on connect.

Audit event types

Each async event's type; handle each appropriately.

“Network connections are asynchronous. State machine is mandatory.”

Build a network state machine. Each state defines allowed actions.

Related reading