I keep getting the error "E 0:05:54:0226 add: Condition "p_elem->_root" is true. "

On Godot 4.2.1

The error seems to appear almost at random sometimes. I can semi-consistently cause it to occur when my player character dies, but even then it won’t always. Sometimes it even occurs regardless if the player is dead/dying or not. I’ve seen conflicting reports online regarding what causes the error but I haven’t found anything concrete. It hasn’t caused the game to crash or anything yet but I’d rather not just let it slide.

Player Death Script:

func damage():
if player_global.is_dead == false:
		speed = 0
		velocity = Vector2(0,0)
		player_global.live -= 1
		player_global.stamina = 0
		player_global.is_dead = true
		stagecontroller.current_no_hit_bool = true
		playthroughcontroller.total_deaths += 1
		dust_fx_emit = false
		$AnimatedSprite2D.play("player_death")
		$fx/sweat_fx.play("normal")
		if player_global.live >= 0:
			$respawn_timer.start()
func _on_respawn_timer_timeout():
	var respawn_pos = player_global.player_respawn_pos
	player_global.is_dead = false
	global_position = respawn_pos + Vector2(0,-12)
	speed = 180
	friction = 0.5
	acceleration = 0.5
	$AnimatedSprite2D.play("player_idle")

Before we dive into this topic, could I ask you to mention your version and wrap the codes in ``` so that they can be easily read?
`‌``

func _ready():
    ...

`‌``

My bad. I just updated the post now.

Do you have VisibleOnScreenEnabler2D in your scene?

Yes but I’ve already removed them and I still get the error.

I checked it out, and it seems that when two VisibleOnScreenEnabler2D objects enter the screen at the same time (when they send the screen_entered signal), this warning gets triggered. In your app, apparently two objects are appearing at once, which is causing the error to show up.
I’m not really sure about this, but it might be the case. Maybe using call_deferred could help you out.

I just double check all my scenes and not a single one sends the screen_entered signal. Strangly though I’ve also since been able to reproduce the error by walking atop or next to seemingly random scene tiles in my tile map, but it’s still too inconsistent to say affix the error to any one particular thing. So I’m stumped.

This error is an open issue in the Godot repository, so you can’t expect it to be fully resolved, but there’s more information here