Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene file became corrupted/invalid. #80324

Closed
Tracked by #80877 ...
carllacan opened this issue Aug 6, 2023 · 5 comments · Fixed by #90269
Closed
Tracked by #80877 ...

Scene file became corrupted/invalid. #80324

carllacan opened this issue Aug 6, 2023 · 5 comments · Fixed by #90269

Comments

@carllacan
Copy link

Godot version

v4.1.1.stable.official [bd6af8e]

System information

Godot v4.1.1.stable - Manjaro Linux #1 SMP PREEMPT Tue Jul 25 07:09:46 UTC 2023 - Vulkan (Forward+) - dedicated AMD Radeon RX 550 / 550 Series (RADV POLARIS12) () - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

Issue description

I was working on a game and all of a sudden I started getting a warning about a certain scene file being corrupted/invalid. As far as I remember I had recently done any changes on that file. When running the game the scene continues to be successfully instantiated, but I can't open it to edit because the aforementioned error message pops up.

Steps to reproduce

Unknown.

Minimal reproduction project

As GitHub does not allow me to attach .tscn files I attach the scene file with a .txt extension: base_ship.txt

@KoBeWi
Copy link
Member

KoBeWi commented Aug 6, 2023

The scene seems to be missing dependencies.
GDScript dependencies can break if you use preload inside global classes, see #79840

@dalexeev
Copy link
Member

dalexeev commented Aug 6, 2023

Or cyclic dependencies. See #74253 (comment), try to replace preload() with load().

@jivvy
Copy link

jivvy commented Oct 8, 2023

This has been happening consistently to me recently. v4.2.dev.custom_build [ 6916349 ].

Logs:

ERROR: res://scenes/ui/end_screen.tscn:12 - Parse Error:
   at: _parse_node_tag (scene/resources/resource_format_text.cpp:284)
ERROR: Failed loading resource: res://scenes/ui/end_screen.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:274)
ERROR: Condition "nc == 0" is true. Returning: nullptr
   at: instantiate (scene/resources/packed_scene.cpp:141)
ERROR: Condition "nc == 0" is true. Returning: nullptr
   at: instantiate (scene/resources/packed_scene.cpp:141)

I don't know if it's a coincidence, but one of two scenes were alternatingly being invalid/corrupt. They were preloading each other in their scripts. After changing one of them to a load , the problem hasn't happened again

@RayJJ
Copy link

RayJJ commented Nov 24, 2023

Similar behaviour in 4.2.rc1 - I have 'Restore Scenes on Load' selected in the Editor Settings.

Opening the editor often reports one or more of the previously open scenes as corrupt/invalid and refuses to reopen them from the FileSystem dock. Running diffs of the .tscn files with their latest git commits shows no changes.

As @carllacan reported, running the game in the editor is unaffected. In my case after running the game once I can open and edit the .tscn files again, so this is a great workaround.

@KoBeWi
Copy link
Member

KoBeWi commented Jan 20, 2024

I checked again if any of the scene opening fixes would resolve this issue and no, the scene still can't be opened.
This is some weird case. When you try to open it, you get a missing dependency error listing only the shader:
image
Clicking Open Anyway will result in a corrupted error and fails.

However if you remove only the shader, you get this instead:
image
Suddenly the editor sees all other dependencies. Opening it (at least with #86781 applied) will succeed.

Looks like some bug specific to shaders.

EDIT:
Ok it's not specific to shaders. The first dialog shows the first missing ext_resource, but only down to some specific point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants