Error message unclear: Parent node is busy setting up children, add_node() failed. How to debug?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dieter

Hey all,
I’m not sure if this is a bug or I’m just doing something funky. I’m getting the error:

Parent node is busy setting up children, add_node() failed. Consider using call_deferred("add_child", child) instead.

Now I did figure out you’re not supposed to use add_child inside _ready so I’ve refactored until all my _ready()s are clean and use call_deferred if adding nodes. However, I still get the error. I have a couple of more issues with it:

  • It does not point to any specific line in my code. This makes it very hard to debug.
  • It seems to run before my actual code is run. See below for a copy paste from my debugger. It shows right after – Debugging process started –
  • It also keeps appearing after I close the game down.

Does anyone know what’s going on and how to solve this? Many thanks!

--- Debugging process started ---
Parent node is busy setting up children, add_node() failed. Consider using call_deferred("add_child", child) instead.
Godot Engine v3.5.stable.official.991bb6ac7 - https://godotengine.org
OpenGL ES 2.0 Renderer: Apple M1
:bust_in_silhouette: Reply From: Dieter

Finally I found the cause of the error. Just posting it here in case it helps someone else. It was a sprite that was being loaded and set in the ready() function an obscure effect scene. So apparently load() in _ready() also causes the “Parent node is busy setting up children, add_node() failed. Consider using call_deferred(“add_child”, child) instead.” error.

A couple of things I thought are not-helpful:

  • The error message does not mention load(), just add_child.
  • The error message does not point to the line or even script where the error is happening.
  • The error message happens strangely before and after the debugging starts/ends.
:bust_in_silhouette: Reply From: d2clon

I had the same issue and in my case was a “RESET” Animation into my AnimatorPlayer:

I deleted it and now I don’t see the warning.

Disclaimer: I am very new to Godot :slight_smile:

Thanks, this fixed it for me too, this was driving me crazy. It also caused knock-on effects on the rect_position of the node where when I switched between scenes in the Godot editor, it changed that node’s position to incorrect values.

mkx | 2023-03-25 18:36