Quick answer: GameMaker Async Networking event firing for a socket that was already closed? GM doesn't always purge events for closed sockets - check socket validity in handler.

Closed a socket. Subsequent network event fires for the closed socket; handler crashes on socket use.

Validate the socket

if (!network_socket_is_valid(async_load[? "socket"])) return;

Skip events for closed sockets.

Track sockets in a set

Add on open; remove on close. Handler checks membership.

Or drain on close

After close, pump events for one frame to drain. Subsequent events shouldn't fire for that socket.

“Network events are async; cleanup is sync. The gap is the bug surface.”

Treat network handlers as defensive. Validate everything; the cost is small.

Related reading