Need help fixing on_spawn_receive() error in godot multiplayer

I got through the godot multiplayer course and have been trying to make a hide and seek style 3d multiplayer game on my own, where the seekers are bug exterminators and the hiders are bugs. I keep getting this one error on the client instance:

E 0:00:03:489 on_spawn_receive: Condition “parent->has_node(name)” is true. Returning: ERR_INVALID_DATA
<C++ Source> modules/multiplayer/scene_replication_interface.cpp:601 @ on_spawn_receive()

here is my level logic, attached to the root node of my map. I’m assuming it’s an issue with spawning players specifically. This error does not pop up without any clients.

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):
	if players_container.has_node(str(id)):
		return  # Already exists, skip
	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

I think you’ll probably be better served asking about this in our Discord server (under the Community tab on the main site homepage). Apart from the Blender Collab and the Talk subforums, this forum is mostly for asking questions directly related to course content, but there are people on the server who are well-positioned to give you a hand =)