My main game scene won't open

Godot Version

4.2

Question

I just opened the project again and I got the pop up saying this:

Scene file ‘main.tscn’ appears to be invalid/corrupt.

And in the output window this error shows up:

Failed to instantiate scene state of “res://Scenes/main.tscn”, node count is 0. Make sure the PackedScene resource is valid.

did you delete or edit anything related to scene file from outside godot editor?

No I just opened the project where I left it off.

When I run the game it still works somehow.
These errors show up in the debugger when running the game:

E 0:00:01:0925 _parse_ext_resource: res://Scenes/main.tscn:5342 - Parse Error: [ext_resource] referenced non-existent resource at: res://Scenes/main.gd
<C++ Source> scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()

E 0:00:02:0192 set_path: Another resource is loaded from path ‘res://Scenes/main.tscn’ (possible cyclic resource inclusion).
<C++ Error> Method/function failed.
<C++ Source> core/io/resource.cpp:75 @ set_path()

E 0:00:23:0900 main.gd:18 @ swap_level(): Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.
<C++ Error> Condition “body->get_space() && flushing_queries” is true.
<C++ Source> servers/physics_2d/godot_physics_server_2d.cpp:654 @ body_set_shape_disabled()
main.gd:18 @ swap_level()
main.gd:7 @ _on_enemy_area_body_entered()

my guess is it’s not enough space to save the scene, hence corrupted. someone here got the problem here, and needed to use godotre to take back the corrupted scenes and file by reverse engineering the exported/built game. he done that because he didnt do version control

So does that mean there’s no hope of recovering the scene?

you can open the scene by text, and see what’s wrong and fix it

else if it’s corrupted, it’s corrupted, just load your last saved files

So do I just delete line after line and see what’s the problem?

that’s not how you do it to fix the corrupted scene file… better just load where your last saved file at

The scene’s been saved in the corrupt state so I don’t know how to go back to previous save file

people use git for version control, so you not, did you have the game exported before?

No I don’t even have a backup save. It’s fine I can start the main scene again.
Thanks for trynna help!

1 Like

It sounds like you got what sometimes happens to me — a scene that has not changed is said to be corrupted. Usually I can quit to project list and it’s OK. Sometimes I have to quit and restart Godot. I think once I had to do that twice.

Not reproducible so hard to file a bug report.