Skip to content

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.

Download for macOSDownload for WindowsDownload for Linux

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'.

More on this: Preload file "…" does not exist in Godot 4

Reproduce it

A node asking for a child named Player that it does not have.

More on this: Parent node is busy setting up children, `add_child()` failed in Godot 4

GDScript
extends Node

func _ready() -> void:
	var player = get_node("Player")
	print(player)

What Godot 4.7.2 prints

Output
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.

More on this: Invalid operands 'Nil' and 'int' in operator '+' in Godot 4

GDScript
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

Output
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

Player
boss: <Object#null>

Run this fix with your agent

Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.

Prompt
My Godot 4 project prints this error: "Node not found: "Player" (relative to "/root/Repro").". Find where it comes from and fix it. 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. Then run the game headless and check that Godot's output no longer shows it.

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.

More on this: Signal '…' is already connected to given callable '…' in that object in Godot 4

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, Node.get_node_or_null in the class reference.

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.

Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.

Download Flockbay free