Windows Cook Content fails with a generic error

Hey,

I am trying to cook a project, but it fails with the errors below. Build for editors works fine, but I cannot do a package for windows.

NOTE: GameGameModeBase.cpp:17 is a part of cunstructor, I tried to comment everything there, but I still have the same error. Another weird thing, I do not have this path at all on my PC [File:D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp]

UE5
VS2022

Any ideas? Thank you.

...
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: begin: stack for UAT
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: === Handled ensure: ===
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error:
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: Ensure condition failed: !GIsDuplicatingClassForReinstancing || InClass->HasAnyClassFlags(CLASS_Native) [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2446]
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: Stack:
...
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc181ecaac UnrealEditor-Game.dll!ConstructorHelpersInternal::FindOrLoadClass() [Z:\Unreal\UE_5.0\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h:87]
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc181f41fc UnrealEditor-Game.dll!AGameGameModeBase::AGameGameModeBase() [Z:\Projects\Game\Source\Game\GameGameModeBase.cpp:17]
...
UATHelper: Packaging (Windows): ERROR: Cook failed.
UATHelper: Packaging (Windows):        (see C:\Users\Ilya\AppData\Roaming\Unreal Engine\AutomationTool\Logs\Z+Unreal+UE_5.0\Log.txt for full exception trace)
UATHelper: Packaging (Windows): AutomationTool executed for 0h 1m 23s
UATHelper: Packaging (Windows): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
UATHelper: Packaging (Windows): BUILD FAILED
PackagingResults: Error: Unknown Cook Failure
...

And the code example it doesn’t like:

	ConstructorHelpers::FClassFinder<UUIChestRewards> UUIChestRewardsBPClass(TEXT("/Game/UI/UI_ChestRewards")); 
	if (UUIChestRewardsBPClass.Class)
	{
		UILevelUpRewardsClass = UUIChestRewardsBPClass.Class;
	}
2 Likes

I am still trying to debug this and noticed that I cannot load any bliueprint that has a Subclass field of a Common UI Widget. I still do not have a way around. It fails on the next run after I set UI class in editor insread of code.

I did not find any solution. I had to remove CommonUI from my project and rebuild all UI. Be careful with that plugin, I wasted a lot of time :confused:

Same problem here. I’m trying to find the cause of the issue, but it’s very hard, because it has something to do with CommonActionCommited_PythonCallable, which is something of the PythonScript plugin and has nothing to do with my code. :frowning:

EDIT:
After some furious debugging (I wasted a lot of time like you) I found the issue :joy: . Because of the loading phases of the two plugins, the variable GIsDuplicatingClassForReinstancing was true and the Python plugin was creating a default object while that variable was true. This is what I did: I edited PythonScriptPlugin.uplugin and changed LoadingPhase of PythonScriptPlugin from PreDefault to Default. I don’t know if this breaks something inside the PythonScriptPlugin though, but I don’t use it so I don’t care (and I couldn’t disable it because it’s used by Niagara). I think this is an acceptable fix until Epic fixes the problem. Another fix that you can do is disabling the ensure condition in UObjectGlobals.cpp, but maybe it’s more destructive than changing the loading phase of the Python plugin.

4 Likes

I just wanted to say thanks for this post. I had the identical issue and this saved me some debugging time.

1 Like

Thank you! I was running into the same problem, and this fixed it. I don’t love the idea of making this change to a plugin in an installed engine version, but this was a relatively simple fix. I’d love for Epic to fix this issue in the engine.

1 Like

incredible. this fixed the issue for me as well (specifically, a uuserwidget blueprint that used commonui erroring out in packaging for windows). thank you!

my project is on 5.2. the exact location of that file on 5.2 is UE_5.2/Engine/Plugins/Experimental/PythonScriptPlugin/PythonScriptPlugin.uplugin and the change is made on line 26.

2 Likes

Same problem got, CommonUI is widely used, need EPIC’s official fix.