Cook error about _Generated_ files when creating patch

Hello,

we are currently using UE 5.7.4 from github.

We released our game and several patches for all consoles with previous versions of the engine. We now need to release our latest patch, but the cook fails using our usual build pipeline.

We run our cook step as (redacted the platform as this is a general issue, all of them fail in the same way)

C:\unrealprojects\gamename>C:\unrealprojects\UE5Engine/Engine/Build/BatchFiles/RunUAT.bat -ScriptsForProject=C:\unrealprojects/gamename/gamename.uproject BuildCookRun -project=C:\unrealprojects/gamename/gamename.uproject -unrealexe=UnrealEditor-Cmd.exe -buildmachine -nosign -nocodesign -config=Shipping -platform=[PLATFORM] -distribution  -createreleaseversionroot=C:\unrealprojects/gamename/Releases -basedonreleaseversionroot=C:\unrealprojects/gamename/Releases -originalreleaseversion=1.0 -createreleaseversion=1.5 -basedonreleaseversion=1.4 -noP4 -skipbuild -cook  -unversionedcookedcontent -skipstage -skippak 

Then we see many thousands of errors (>1000 per map) about strange assets being cooked (see example below). We never got any similar issues with previous releases.

LogCook: Warning: Unexpected failure to cook filename 'C:/unrealprojects/gamename/Content/Maps/BoucleOval/BoucleOval/_Generated_/01TG5102A1A3Q4Q0YSX81MLCU.umap'. It is mapped to PackageName '/Game/Maps/BoucleOval/BoucleOval/_Generated_/01TG5102A1A3Q4Q0YSX81MLCU', but does not exist on disk and we cannot verify the extension.
LogCook: Error: Could not find package at file C:/unrealprojects/gamename/Content/Maps/BoucleOval/BoucleOval/_Generated_/01TG5102A1A3Q4Q0YSX81MLCU.umap!

This is severely blocking our submission process for the new release, which is due in very few days.

Regular shipping distribution builds (their pipeline only differs for the release version arguments) are performed correctly.

Could you please advice on this at your earliest convenience? Thanks a lot for your kind support.

Best regards,

Pibo

[Attachment Removed]

Steps to Reproduce
In UE 5.7.4, cook your game using -createreleaseversion=1.2 -basedonreleaseversion=1.1 -originalreleaseversion=1.0

The cook fails with thousands of errors like

LogCook: Warning: Unexpected failure to cook filename 'C:/unrealprojects/gamename/Content/Maps/BoucleOval/BoucleOval/_Generated_/01TG5102A1A3Q4Q0YSX81MLCU.umap'. It is mapped to PackageName '/Game/Maps/BoucleOval/BoucleOval/_Generated_/01TG5102A1A3Q4Q0YSX81MLCU', but does not exist on disk and we cannot verify the extension.
LogCook: Error: Could not find package at file C:/unrealprojects/gamename/Content/Maps/BoucleOval/BoucleOval/_Generated_/01TG5102A1A3Q4Q0YSX81MLCU.umap!

All our maps use world partition.

[Attachment Removed]

Hi,

We think this is a bug that was introduced in CL44557776. The CL introduces a different behavior in UCookOnTheFlyServer::GetAllPackageFilenamesFromAssetRegistry for generated packages which is later resulting in the errors because the files don’t exists. I was able to get a successful cook by restoring the old behavior. You can try this change which should pull you through:

//in CookOntheFlyServer.cpp
 
...
bool UCookOnTheFlyServer::GetAllPackageFilenamesFromAssetRegistry(const FString& AssetRegistryPath, bool bVerifyPackagesExist,
	bool bReevaluateUncookedPackages, TArray<UE::Cook::FConstructPackageData>& OutPackageDatas) const
{
... 
//line 12342
				bool bGeneratedPackage = !!(RegistryData.PackageFlags & PKG_CookGenerated);
				if (bVerifyPackagesExist /* && !bGeneratedPackage*/)
				{
 					if (!bGeneratedPackage) 
					{
						UE_LOG(LogCook, Warning, TEXT("Could not resolve package %s from %s"), *PackageName.ToString(), *AssetRegistryPath);
					}
				}
				else
				{
					const bool bContainsMap = !!(RegistryData.PackageFlags & PKG_ContainsMap);
					PackageFileName = FPackageDatas::LookupFileNameOnDisk(PackageName,
						false /* bRequireExists */, bContainsMap);
					if (!PackageFileName.IsNone())
					{
						PackageData.NormalizedFileName = PackageFileName;
					}
				}
...

Please note that this will break the cooking of DLC. We will work on a proper fix in the Main stream.

Regards,

Martin

[Attachment Removed]

Hello Martin,

Thanks a lot for responding so quickly.

I’ve applied the change you suggested and the builds actually completed with no errors.

Best regards,

Pibo

[Attachment Removed]