Sending RPC for QueuFree gets Node not found error

Godot Version

4.2.1

Question

When my player walks into an Area3d object it sends an RPC to QueueFree() the object. The object disappears on server and client but I get an error on the server.

E 0:03:02:0788 get_node: Node not found: “Level/Enemy” (relative to “/root”).
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1638 @ get_node()
E 0:03:02:0788 process_confirm_path: Parameter “node” is null.
<C++ Source> modules/multiplayer/scene_cache_interface.cpp:123 @ process_confirm_path()

This error did not occur in Godot 4.1, only since upgrading to 4.2.

Haven’t you changed any part of code?

I don’t have any experience either on 3D or Server/Client but I know for sure that is a missing reference.

It sounds like something was trying to call/reference the node when it had been freed.

I suspect what’s happening is that an RPC calls through from the client after the node has been freed. Not sure why this would change between versions, but even normally I can imagine this happening if there’s enough latency between server and client.

I’d either accept it as a known “issue” that doesn’t affedt much, or deactivate the node on the server and delay freeing for a bit. But only on the server.

This is the code for it. Possibly is some Known Issue, but I usually assume I’ve done something wrong.

	public void OnArea3dBodyEntered(Node3D body)
	{
		if(!Multiplayer.IsServer()) return;

		if(body.IsInGroup("Players"))
		{
			Rpc(nameof(Destroy));
		}
	}

	[Rpc(MultiplayerApi.RpcMode.AnyPeer, CallLocal = true, TransferMode = MultiplayerPeer.TransferModeEnum.Reliable)]
	public void Destroy()
	{
		QueueFree();
	}

Github Project works with 4.1 and get error in 4.2

Have you tried @elementbound suggestion?