Intermittent "Content is missing from cook" errors

Hey folks!

Since we upgraded to UE 5.7, we’ve been experiencing random cook errors in the format of:

LogInit: Display: LogCook: Error: Content is missing from cook. Source package referenced an object in target package but the object was stripped out of the target package when saved.
Source package: /Game/SomeMap/_Generated_/8S2T5SYER3S7Y1PG8GDCR8G78
Target package: /Game/SomeBlueprint
Referenced object: /Game/SomeBlueprint.SomeBlueprint_C:SomeInheritedComponent_GEN_VARIABLE

These errors seem to occur completely at random (as in: we can’t reproduce them on purpose, even with the exact same setup), but the missing referenced object is ALWAYS a _GEN_VARIABLE object for some inherited blueprint component and usually it’s the same actor and blueprint triggering the error.

We already tried completely deleting the affected actor(s) and blueprint and recreating them, but this did not fix the issue.

I found multiple other reports of this issue here, but we are currently on UE 5.7.4, so we should already have all the supposed fixes that were mentioned in the other threads.

After some debugging, I found that our issue exactly matches the description Dan O’Connor gave in the last reply to [this [Content removed] The problematic _GEN_VARIABLE object is inherited from a parent blueprint and does not have any changes in the child blueprint so it is stripped out during cooking.

However this also applies to hundreds of other similar blueprints/actors and those seem to work just fine, so I am still not really sure what the difference is here and what to do about it.

This issue occurs quite frequently and blocks our builds, so it would be great if you have any suggestions on how to get rid of that.

Cheers,

Dave

>so I am still not really sure what the difference is here and what to do about it.

The mutator in question is void UInheritableComponentHandler::ValidateTemplates(). That function is trying to remove component template objects that are not needed (the else branch of if (bIsValidAndNecessary)).

If the Reference object is consistent I would instrument that function with conditional log statements, along with one in the native constructor of the component in question (object names and paths are available in constructors).

The cooker is detecting that we run UInheritableComponentHandler::ValidateTemplates() and remove one or more component templates, but then the component template is either recreated (e.g. reloaded as part of cooking) and not validated or validated and deemed neccsesary - at which point it is then typically implicitly referenced by some other asset.

I hope that suggestion is helpful and that the context gives you some ideas for debugging the problem.