ERROR: Condition "peer > 0 && !connected_peers.has(peer)" is true

Godot Version

Godot Engine v4.3.rc1.official.e343dbbcc

Question

Can confirm this problem still exists in Godot Engine v4.3.rc1.official.e343dbbcc

1722511842492

...
multiplayer.multiplayer_peer = server_peer
multiplayer.peer_connected.connect(_on_peer_connected)
multiplayer.peer_disconnected.connect(_on_peer_disconnected)
...

func _on_peer_disconnected(client_id: int) -> void:
	print("[server:client:disconnected]", str(client_id))
	if data["players"][str(client_id)]:
		var players_node = get_parent().get_node("Players")
		if players_node.has_node(str(client_id)):
			var player_node = players_node.get_node(str(client_id))
			player_node.queue_free()
			data["players"].erase(str(client_id))
			print("[server:client:disconnected:remove]", str(client_id))
			rpc("on_remove_player", client_id)

This error only occurs when there are multiple players connected to the server; if the last player leaves the game, there are no errors.

Need help!!!

I have prepared a minimal error example. The usage is as follows:

1、Export server.exe and run the server with “server.exe --headless”.
2、Run two client windows in the editor, ensuring both clients join the game.
3、Close any one of the client windows, and you will see the related error information on the server.

This error occurs in multiplayer scenarios. As the number of clients increases, more error messages will appear.

https://github.com/user-attachments/files/16478185/BugTest.zip

Hey there, this error was fixed in RC3!
“Multiplayer: Avoid error spam in relay protocol when clients disconnect”.

1 Like

Thank you, it has been fixed and I have also noticed this information

1 Like