This looks analogous to what’s been happening in Kaan’s course with needing to add call_deferred()
to the scene management code. From what I can tell, this error is happening because your game is trying to delete the nodes of a client that has disconnected, but the client is already gone because they hard-disconnected, so there was no opportunity to do the cleanup safely if that makes sense. This would also explain why it doesn’t affect your gameplay and only happens when you shutdown.
What little I could find seems to back this up:
https://www.reddit.com/r/godot/comments/1b1f39e/is_it_possible_to_make_multiplayerspawner_not/
Does the same thing happen if you click the Stop button in the editor window vs. clicking a game window’s X (close) button?
I would imagine that the way you prevent this error from occurring is by using something similar to call_deferred()
for the process of disconnecting, but more along the lines of exception handling than waiting for the frame to finish - if the node isn’t there, break. remove_child()
might be one piece of the puzzle, as that will isolate the node so that further processing on it can’t affect the rest of the scene tree, but on the other hand, this might be exactly what it’s trying to do and it can’t because the node is already gone.
Basically, I’m not sure I can help much here, but I also think that if there is one error you could live with in a production build, it would be this one. The message indicates a graceful recovery of the C++ code anyway, so don’t let it prevent you from continuing the course.
If you manage to find a solution, or experiment results, or anything else, please update this topic for us =)