godot: Invalid packet received. Unabled to find requested cached node.

Godot version: 3.2beta4 OS/device including version: debian 10 Issue description:

ERROR: _process_get_node: Invalid packet received. Unabled to find requested cached node.
   At: core/io/multiplayer_api.cpp:263.
ERROR: _process_packet: Invalid packet received. Requested node was not found.
   At: core/io/multiplayer_api.cpp:202.

The error happen after i use disconnect_peer(id) from server and I try again to reconnect from client. If I restart the client after disconnect I can reconnect with no problems Can be related with other cache network issues already closed but I’m not sure.

As workaround I reinstance NetworkedMultiplayerENet every time i call close_connection

Steps to reproduce: NA (ask for more info if you need) Minimal reproduction project: Is a client server approach in same computer for now.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

Oh, I see, the problem is that you re-assign the network_peer in the client with the same peer every time. This cause the multiplayer API to not be reset (see #25010). To fix it, simply use a new NetworkedMultiplayerENet every time, or set the network peer explicitly to null before setting the new peer:

func _on_JoinServer_pressed():
	host = NetworkedMultiplayerENet.new() # New object every time
	var ip = "127.0.0.1"
	host.create_client(ip, PORT)
	get_tree().set_network_peer(host)

or:

func _on_JoinServer_pressed():
	var ip = "127.0.0.1"
	host.create_client(ip, PORT)
	get_tree().set_network_peer(null) # Force reset
	get_tree().set_network_peer(host)

In general, setting the network_peer to the same value it already has, will result in a no-op. This is done to avoid problem related to the fact that the following GDScript code:

multiplayer.network_peer.refuse_new_connections = false

Will cause first refuse_new_connections to be set on the network peer, then network_peer to be set on multiplayer, potentially causing reset.

@git2013vb I would ask you not to make demands like this for contributors. Most contributors work on their free time, and if you’re not satisfied with their work, that doesn’t give you a right to demand that they do more work.

Feedback is welcome, pointing out missing documentation is welcome, but bossing people around is not. If the feature is too undocumented to be useful to you, you can simply not use it until contributors get to document it better.

And the talk about money is uncalled for and completely off topic.

Remember that Godot’s documentation is open to contributions. The best way to fix this kind of issues is to work on it yourself 🙂

To fix it, simply use a new NetworkedMultiplayerENet every time, or set the network peer explicitly to null before setting the new peer:

Thank you, saved me a lot of headaches here. I wish this kind of issue was explicitly documented on the page.

I don’t understand. When you say “the problem is that you re-assign the network_peer in the client with the same peer every time” mean is the wrong approach? If is wrong (I saw it in docs) can explain me how have to be implemented? My goal is to connect to the server when I need - even when I disconnect using:

func _on_Button_pressed():
	host.close_connection()

Why you said “every time”? Of course I will use it when I need to connect with server.
What the use of “close_connection”? I was expecting to work normally like if you “close” the you can “reopen” it again Your explanation confuse me.