Parent node is busy setting up children, `add_child()` failed in Godot 4
By Eduardo Orellana · Updated
The parent is in the middle of adding its children, and Godot refuses to change that list until it is done. get_parent().add_child(child) from a child's _ready() prints Parent node is busy setting up children, `add_child()` failed. Defer the call: get_parent().add_child.call_deferred(child).
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
While a node is adding its children and running their _ready(), it marks itself blocked. add_child() on a blocked node prints this error and returns without adding anything; the script carries on, so the child is simply missing.
call_deferred() runs the call at the end of the frame, after the parent has finished, when the child list can change.
Reproduce it
A node that adds a sibling from its own _ready(), while its parent is still setting up.
extends Node
func _ready() -> void:
var spark = Node.new()
spark.name = "Spark"
get_parent().add_child(spark)
print("after")
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
ERROR: Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
at: add_child (scene/main/node.cpp:1721)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/parent-node-is-busy-setting-up-children/repro.gd:6)
after
WARNING: 1 ObjectDB instance was leaked at exit (run with `--verbose` for details).
at: cleanup (core/object/object.cpp:2536)Fix it
Defer the add_child() and check on the next frame that it happened.
extends Node
func _ready() -> void:
var spark = Node.new()
spark.name = "Spark"
get_parent().add_child.call_deferred(spark)
await get_tree().process_frame
print(get_parent().has_node("Spark"))
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
trueVerified on Godot 4.7.2
Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 18 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: [node.cpp line 1721, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/scene/main/node.cpp#L1721).
Questions
- Why does add_child() work in _ready() on the same node?
- A node can add its own children in _ready(). It is the parent, still running its children's _ready(), that is blocked.
- Is call_deferred() the same as await process_frame?
- No. call_deferred() runs at idle time at the end of the current frame; await get_tree().process_frame waits for the next frame to start.
Related
- Node not found: "…" (relative to "…")
- Invalid call. Nonexistent function 'instance' in base 'PackedScene'
- Every verified Godot 4 answer
- How to change scenes in Godot 4: change_scene_to_file()
- Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead in Godot 4
- Can't add child '…' to '…', already has a parent '…' in Godot 4
- Invalid access to property or key on a base object of type 'null instance' in Godot 4
- How to disable and enable a node in Godot 4: process_mode
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free