Failed to load [filename] Referenced by [function]

Hello,

I have multiple projects that has a load error on startup:

Failed to load “Filename” Referenced by “Specific function or WidgetTree” whereas the widget tree is a reference to a specific widget element.

These things seem to happen over time (probably due to folder renames), and I have no clue on how to solve it. Googling did not result in much useful things for me except some links to 404 pages.

Reverting is not an option since these are active projects and I do not know when it was instigated. Also, I am experiencing this issue a lot in general and I do not want to revert every time or when it is not possible like now, I need to find a solution.

Does anybody now how to solve this? I wonder why it even happens. I’ve read the Core Redirects documentations which I think gives good insight, but does not supply any edit or debugging functionality.

Thank you in advance and with kind regards,

Eric

I’m also interested on this. Apparently everything is fine, references are OK and Play (even packaged build) work without errors.

Have you tried selecting the changed folders and right clicking them in the content browser and selecting “Fix Up Redirectors”?

Yes. But it is good to know that there is no redirector to be “fixed”. This seems like a pointer issue somewhere in unreal itself after fixing up redirectors when have a struct moved and changed while not being processed in all dependencies.

Did you solved it? It’s so annoying and i find nothing to do with it,even replace it with a older version won’t help.

No I have not. I’ve reverted back to the revisions before moving the struct.

I need to explain a bit on how the reference and loading system in Unreal works first to explain how to figure this out to fix it.

Dependencies in Unreal

Save Time

When an asset is saved Unreal goes through all of the asset’s dependencies and saves them in a list in the uasset itself, called the Imports List. Gathering all the referenced assets takes a little while so it only happens on save time. This is the list that the Asset Registry loads to know what references what, and uses it to populate the information in Reference Viewer and Map View. Since it’s all pre-saved it’s very fast to query.

But since the dependencies get saved into the asset it’s also possible for you to then later on delete one of those dependency assets without the parent asset “knowing” of it. This can happen if you delete the asset directly from the hard drive through Windows Explorer, or through a bad version control file merge. If the deletion of an asset doesn’t happen in Unreal, then Unreal can’t warn you about the asset still being referenced somewhere else and shouldn’t be deleted.

If the asset is suddenly missing without Unreal knowing of it, then when loading the parent asset you’ll see that error as it tries to load a depending asset that doesn’t exist.

Load Time

This dependencies list is also the list that Unreal uses to know what it needs to load with the asset itself. At load time, the linker (you can think of it as the “loader” in this example to be a bit more clear on what it does) reads this list of referenced assets (it’s “dependencies”, or it’s “imports”) and loads them with the asset itself. It does this recursively.

This error that you’re seeing is being emitted at load time, from LogGetPackageLinkerError in Linker.cpp. If you put a breakpoint in there to see why it’s happening it will not tell you much since assets only know what they reference at load time, not why.

Finding Why an Asset Is Depending on Another Asset

Since assets gather their dependencies at save time, that’s when you should be debugging why it’s trying to add some assets as a dependency.

You’ll need to do some C++ debugging to figure out what is introducing the dependency. You can do it with a launcher build of UE with some breakpoint debugging, or in case you have a source compiled version of UE, you can do it quite quickly with one line code line.

UE5

In UE5, all dependencies are added in FPackageHarvester::TryHarvestImportFPackageHarvester::HarvestImport.

It’s easiest to use a Conditional String Breakpoint in the debugger to have the breakpoint hit when your desired asset name is encountered.

If those aren’t working for you for some reason and you have the possibility to change the source code, you can also add a conditional break at the top of either of the harvesting functions mentioned above. This is especially easy if you use Live Coding:

if (InObject->GetFName().ToString().Contains(TEXT("BP_YourAsset")))
	UE_DEBUG_BREAK();

When you hit that function as it references your unwanted asset dependency, check the stack when that breakpoint is hit for the name of the property or other reason that references your asset. SerializeTaggedProperty will have the property name for example.

UE4

In UE4 the dependency gathering is a bit different.

You can put a breakpoint in UPackage::Save, just before Pkg->Mark(OBJECTMARK_TagImp);.

Or in FArchive& FArchiveSaveTagImports::operator<<( UObject*& Obj ) (or any of its other << operators).

Again, you can then see the reason why it’s being referenced from the callstack.

Possible Causes

The most likely reason this is happening is because you are simply referencing the now-missing asset. Maybe there’s a Cast node in the Blueprint casting to that asset type, a variable of that asset’s type, or a variable referencing that asset. Maybe an array. You’ll find out during the breakpoint debugging.

Best of luck with your hunt!

10 Likes

Hey Ari,

Thank you for the detailed explanation. It gives a lot of insights and good pointers how to debug the cause.

I will try it out when I am encountering the issue again. I am really curious what I can find! Especially since the “missing asset” is not missing in the content but apparently is missing on initial load or is not able to find the coupled asset in some edge cases.

Thank you again and have a nice day,

Eric

I am using 5.1 and after I change a struct and then re-open the project I will get that failed to load message, but it plays fins and packages without errors. I have tried many solutions including refresh nodes in all referenced blueprints.

I’ve had a missing asset message in my project for years never could find out why, the other day I deleted a folder with some textures then ended up with another message for some reason some widget tree was looking for something inside a blueprint which used the texture i deleted, so it could be a blueprint using something which has been removed but the warning doesn’t state that.

I’m getting the error after deleting a folder that I’m no longer using. The stupid thing is I’m getting errors saying “Failed to load XYZ file” that wasn’t in the folder I deleted and the file it’s failing to load is right where it thinks it is. Why the Eff would this happen? Fix-up re-directors doesn’t do anything. It’s also saying that my Character BP is referencing a file that isn’t actually used in the player character but in an NPC.

OMG. It was all due to wav files (not cues) referencing a deleted sound class. Even though none of the load errors mentioned the sound class. They all said Can’t find Audio file XYZ.

Hi there @GamesByHyper_Eric,

Hope you’re well!

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

These "Failed to load Referenced by " randomly happen without reasons, often the asset it says referencing another asset, but it doesn’t reference that asset in the reference viewer. The only solution to get rid of these warnings is to migrate the whole project to a fresh 3rd person template or similar new project created by the engine
I don’t understand how does the asset registration work but it seems after months of working on any project it would get corrupted with such confusing warnings and have to be migrated to another fresh project

1 Like

To resolve the issue, it seems only migration works. But rather than migrating your entire project to a new project. There is simpler and faster:

  • Duplicate your project folder.
  • Open your project
  • Migrate only the folder that contains the problematic asset to the project that you duplicated.
  • Open the duplicated project, the error is fixed :wink:
2 Likes

1, Right click Content folder
2, Select “Resave All”
3, Wait
4, Fixed

3 Likes

That worked! (UE5.0.3) I’ve tried dozens of different solutions - nothing resolved the issue, but “Resave All” on Content folder just worked like a charm!
Need to mention however: it took 1h formy middle size project and progress bar was showing non-relative info.
Thanks, +1000 to your karma

Thank you.

+1000 Karma

A king without a crown, that is for you :crown: