I've had this recurring problem where models imported from a .glb file (models saved to file) lose reference to their materials or even to the model itself, after getting lots of these errors and warnings.


(sorry for the text screenshots, after re-opening the project the errors are gone, but the materials are still missing and those images are what I captured at the time)

Reimporting the .glb seems to "fix" some models and bring their materials back (I have the materials set as use external in the import settings), but the next time I open the project the references are gone again.
One way I've found to fix temporarily is deleting the imported mesh resource and reimport the .glb, but that makes me feel like this is a bug.

Also, the worse issue caused here is that some of my materials are losing reference to their shader, requiring me to reconfigure all the parameters even if I can get the reference back, this is a lot of work to keep repeating, so I'm trying to figure out the root cause before I waste more of my time on that. I'm not sure if the material problem is related to the .glb file import since they are external materials not part of the .glb, but they are referenced in the .glb as an external material for the meshes.
I'm reasonably sure they are both related to the invalid UID issue.

Any help in tracking down the cause would be greatly appreciated as I'm worried about how this might affect my game when I have even more assets. I really don't want to have to fix them all every time.
I did try searching the web and Github for similar issues but I only found a couple of similar ones that were either for older versions of Godot, or had no proper solutions.
I'm using Godot v4.1.1.stable.mono.official [bd6af8e0e] on Linux.

As a closing thought; I'm confused about the purpose of the invalid UID warning, as if the resource can be tracked down using it's text path instead, couldn't Godot let the user reset the UID from the correct asset?

Unfortunately, no fix for me either and it seems it is currently the case for all users. I use Godot 4.1 and it seems these warning messages have appeared first with this version (I previously used Godot 4.0 without any messages of this kind).
As my WIP game (TetraBots) is technically quite simple, I have no issues running it but these warnings are annoying and distracting.

    I've seen that warning sporadically with my own assets and in https://github.com/Norodix/GodotMirror
    (godot4 branch, a preliminary 4.x update) every time I run my game. Yep, it's a material. At some point Godot changed the UID in the material .tres file but left the old UID in the .tscn file. Let's see if I can checkout the original material file from git and get Godot to change the UID again... nope, not even when I open the material and tweak the shader parameters.

    I installed that Mirror addon after Godot 4.1.1, so this is a current issue.

    This is just speculation but I've noticed that the Godot editor tends to get into a corrupted state where things are a bit broken, and you just have to reopen your project. I would not be surprised if that's UIDs become inconsistent. Whatever it is, it's extremely annoying and I'll be seriously looking at other engines if this is still happening when 4.2 is released.

    Basically I think it's a design flaw of Godot's resource sharing and inheritance architecture. It's very tricky and I've avoided doing it in my own little engine even though it's tempting. I guess maybe it's too ambitious even for a "real engine". Unfortunately Godot is stuck with it so the best the devs can do is buckle down and fix it.

    Asthalis Yeah, I've noticed some other new warnings in 4.1, mostly related to various GUI nodes. Not sure if I was doing it wrong before or they changed the rules, lol. It is irritating and concerning. This is the kind of instability you have to deal with when you build your own engine from scratch. I might go back to that if this continues into 4.2 and 4.3.

    Another very annoying bug in Godot 4 is the node symbol that does not change if change the node type (you have to close the scene window and open it again to make it work). This never happened with Godot 3.x and it's sometimes very confusing. Hope this will be fixed soon.