Node not found: "…" (relative to "…") in Godot 4
By Eduardo Orellana · Updated
There is no node at that path relative to the node asking. get_node("Player") on a node with no child named Player prints Node not found: "Player" (relative to "/root/Repro") and returns null. Check the name in the Scene dock and the path from the node running the script; use get_node_or_null() when the node may legitimately be absent.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
A relative path is followed from the node that called get_node(): "Player" is a direct child, "UI/Player" a grandchild, "../Player" a sibling. Names are case-sensitive. When a step finds nothing, Node::get_node prints this error with the path and the asking node's absolute path, and returns null.
It is an engine error, not a script error: the script keeps running with null, and the failure usually shows up on the next line, as a call on 'Nil'.
Reproduce it
A node asking for a child named Player that it does not have.
extends Node
func _ready() -> void:
var player = get_node("Player")
print(player)
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
ERROR: Node not found: "Player" (relative to "/root/Repro").
at: get_node (scene/main/node.cpp:1975)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/node-not-found-relative-to/repro.gd:4)
<Object#null>Fix it
The same lookup on a scene that has the child, and get_node_or_null() for an optional node.
extends Node
func _ready() -> void:
var player = get_node("Player")
print(player.name)
var boss = get_node_or_null("Boss")
print("boss: ", boss)
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
Player
boss: <Object#null>The script is on a different node than you think
The path is relative to the node the script is attached to. A script on a child node that asks for $Player looks for a grandchild. Print get_path() to see where the lookup starts.
An instanced scene that renamed its root
When a scene is instanced, its root takes the name you give the instance. A path written against the original name finds nothing.
Verified 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 1976, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/scene/main/node.cpp#L1976), [Node.get_node_or_null in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Node.xml).
Questions
- What is the difference between get_node() and get_node_or_null()?
- Both return null when nothing is found. get_node() also prints this error; get_node_or_null() stays quiet, for nodes that may not exist.
- Can I use a unique name instead of a path?
- Yes. Mark the node Access as Unique Name in the Scene dock and use %Player from any node in the same scene, wherever it sits in the tree.
Related
- Invalid call. Nonexistent function in base 'Nil'
- Invalid access to property or key on a 'null instance'
- Every verified Godot 4 answer
- Cannot call method '…' on a null value in Godot 4
- Invalid access to property or key on a base object of type 'Nil' in Godot 4
- Invalid operands 'Nil' and 'int' in operator '+' in Godot 4
- Cannot get return value of call to "…()" because it returns "void" in Godot 4
- How to get the class name of a node in Godot 4: get_class() and get_global_name()
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free