multiplayer on_spawn_receive error

Godot Version

4.5.1

Question

Hi everyone, I’m making a multiplayer hide and seek game where the seekers (exterminators) are bigger and the hiders (bugs) are smaller. Whenever I run two instances of the game and have them connect to each other, this error pops up on the client’s side:

Nothing wrong seems to happen in game, but I would still like to have this error gone.

This is the level script, a script on the root node of the map that runs when it gets spawned in. If there is anything that could be causing this error I would assume it is in here, but feel free to ask me to send other things in order to diagnose this issue.

extends Node3D

@export var exterminator_scene: PackedScene
@export var bug_scene: PackedScene
@export var players_container: Node3D
@export var spawn_points: Array[Node3D]
@export var player_spawner: MultiplayerSpawner

var next_spawn_point_index = 0

func _enter_tree():
	player_spawner.spawn_function = spawn_player

func _ready():
	if not multiplayer.is_server():
		return
	multiplayer.peer_disconnected.connect(delete_player)
	for id in multiplayer.get_peers():
		add_player(id)
	add_player(1)

func _exit_tree():
	if multiplayer.multiplayer_peer == null:
		return
	if not multiplayer.is_server():
		return
	multiplayer.peer_disconnected.disconnect(delete_player)


func add_player(id):
	var role = Lobby.player_roles.get(id, "bug")
	var pos = get_spawn_point()
	player_spawner.spawn({"id": id, "role": role, "pos": pos})

func spawn_player(data):
	var scene = bug_scene if data["role"] == "bug" else exterminator_scene
	var player_instance = scene.instantiate()
	player_instance.name = str(data["id"])
	player_instance.position = data["pos"]
	return player_instance

func delete_player(id):
	if not players_container.has_node(str(id)):
		return
	players_container.get_node(str(id)).queue_free()

func get_spawn_point():
	var spawn_point = spawn_points[next_spawn_point_index].global_position
	next_spawn_point_index += 1
	if next_spawn_point_index >= len(spawn_points):
		next_spawn_point_index = 0
	return spawn_point

The error means that the MultiplayerSpawner tried to spawn a node but the parent has a node with the same name already.