# Preload file "…" does not exist in Godot 4

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.

Source: https://flockbay.com/godot/preload-file-does-not-exist/ · Updated 2026-10-30

## 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
```

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

```
My Godot 4 project prints this error: "Parse Error: Preload file "res://enemy.tscn" does not exist.". Find where it comes from and fix it. 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. Then run the game headless and check that Godot's output no longer shows it.
```

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

Download Flockbay free: Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot. https://flockbay.com/download/

Related: [Identifier "…" not declared in the current scope in Godot 4](/godot/identifier-not-declared-in-the-current-scope/), [Node not found: "…" (relative to "…") in Godot 4](/godot/node-not-found-relative-to/), [Function "…()" not found in base self in Godot 4](/godot/function-not-found-in-base-self/), [Cannot find member "…" in base "…" in Godot 4](/godot/cannot-find-member-in-base/), [Every verified Godot 4 answer](/godot/), [How do I see Godot’s output and errors in Flockbay?](/docs/how-do-i-see-godots-output-in-flockbay/)
