Preload file "…" does not exist in Godot 4

By Eduardo Orellana · Updated

preload() is resolved when the script loads, and there is no file at that path. preload("res://enemy.tscn") with no such file fails to parse with Preload file "res://enemy.tscn" does not exist. Fix the path (it is case-sensitive in an export), or drag the file from the FileSystem dock into the script to paste its exact path.

AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.

Intel or AMD Chromebook, with Linux turned on.

Download for macOSDownload for Windows

What Godot is checking

preload() loads the resource at compile time, so the analyzer checks the path when the script is parsed. A missing file stops the script before any of it runs.

load() with the same path is checked only when the line runs: it prints an error and returns null instead of stopping the script.

Reproduce it

A script that preloads an enemy scene that is not in the project.

extends Node

const Enemy = preload("res://enemy.tscn")

func _ready() -> void:
	print(Enemy)

What Godot 4.7.2 prints

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

SCRIPT ERROR: Parse Error: Preload file "res://enemy.tscn" does not exist.
   at: GDScript::reload (res://answers/preload-file-does-not-exist/repro.gd:3)
ERROR: Failed to load script "res://answers/preload-file-does-not-exist/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

When the file should exist, fix the path. When it may not, check for it and use load(), which runs only when the line does; preload() cannot be made conditional.

extends Node

const ENEMY_PATH := "res://enemy.tscn"

func _ready() -> void:
	if ResourceLoader.exists(ENEMY_PATH):
		var enemy_scene: PackedScene = load(ENEMY_PATH)
		add_child(enemy_scene.instantiate())
	else:
		print("no scene at ", ENEMY_PATH)

What the fixed script prints

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

no scene at res://enemy.tscn

A file that was moved or renamed outside Godot

Moving a file in the FileSystem dock updates the paths that point at it; moving it in Explorer or Finder does not. Move files inside Godot, or fix the paths after.

Case on export

Windows does not care whether a path says Enemy.tscn or enemy.tscn, but the packed files of an export do. A path that works in the editor can fail in the exported game.

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: [gdscript_analyzer.cpp line 4750, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L4750).

Questions

Should I use preload() or load()?
preload() for resources the script always needs, so a broken path is caught when it loads. load() for paths built at run time, such as a level by number.
Can preload() take a variable path?
No. Its argument must be a constant string, because it is resolved when the script is compiled.