Error " Scene File appears to be invalid/corrupt"

Godot Version

4.2.1 stable

Question

When creating the level, I was creating audio lighting and all that, nothing complicated that in my opinion could cause an error, but nevertheless, after re-entering from the scene, I got this error, and it would be fine if at least something hinted at the origin of this error, but no. No information. What should I do in this situation? I would not really like to recreate most of the work. When trying to enter the desired scene by any means, he throws it to an earlier stage of th


e scene.

I am going to guess you read through this?
https://www.reddit.com/r/godot/comments/124tvg0/the_scene_file_appears_to_be_invalidcorrupt/

Yes, I tried deleting resources through a text file, but either I did something wrong or it didn’t help me, at least it gave me this:

Yes, you may have to google that too. Maybe you deleted some delimiter.

E.g. I found this:
Open res://Nodes/Maps/Level.tscn with a text editor (instead of the engine) - it is likely missing a opening bracket [ in the first line (for whatever reason).

So maybe using external editor to edit the text files.

I tried to find where this symbol is missing, but unsuccessfully, I tried for a very long time to find where it is missing, studied all these lines, but nothing helped. I guess I’ll have to do everything for you.
But thanks a lot for the help anyway.

did you try reloading current project?
the reddit answer also tell the same

Yes i do, but it still not working

did you have exported project/build for this project?
you might want reverse engineering it to recover that specific scene back

I also had this problem happen in my project. One of the solutions in the Reddit thread (although way down, so it’s easy to miss) that worked for me was to rename the “corrupt” scene (eg: scene → scene2), reload the project / exit Godot completely, then load the project and see if I could open the scene normally. It worked for me and, afterwards, I renamed it back to its original name (scene) and had no issues reloading the project.

However, every time that I open up my project for the first time in the day, I get the corrupt message again and have to redo the whole procedure. It might be on every PC restart, but I keep my computer running through the day so I’m not sure.

An interesting thing is that I rebuilt the scene completely, from scratch. I called it the same as the previous one, and for that session everything worked perfect. The next day though, it once again gave me a corrupt message and I had to do the whole rename / reload trick.

I did reuse the original script in the rebuilt scene, so I don’t know if it could be related to that. I also used the same name, so that could be how I replicated it. I don’t see any point in redoing the code since I would probably get the same results, but I’ll try renaming the scene and seeing if that still makes the error pop.

I also had this error and I seem to have solved it with my project.

I opened the file in a text editor and compared it with another .tscn file. In the invalid/corrupt scene file there were two ext_resource components (Texture2D and Script), but they where in reversed order compared to the working scene file.

It was:

[ext_resource type="Texture2D" uid="uid://dblgmiaquojew" path="res://Assets/Sprites/toad.png" id="2_6gejd"]
[ext_resource type="Script" path="res://Player/player.gd" id="1_dnhet"]

The working file had the Script resource first, so I did that with the invalid/corrupt file and that solved the problem and I can open my project normally again.

Weirdly enough, when I open the scene file in a text editor, the order is back to Texture2D and the Script, but I don’t get the error anymore.

Alright, that didn’t help, because opening the project today gave me the error again.

But I found a possible solution in a YouTube comment.
The video is “Fix corrupted Godot scenes (4.1.1)” by godotsimon and the comment is by @plyczkowski, saying:
“Here’s what working for me to fix this error: close editor, search in the .editor folder for all files containing the corrupted scene’s name (they are going to be name something like your_scene_name.tscn-editstate-2e5312b3e75d2338868814f479b1feeb.cfg), delete them, restart editor.”

This seems to be working for me.