Error: Unknown Cook Failure (Ran Out of Memory)

I have had this issue with several different versions of UE4, including those dating back to 4.15. It only occurs on a single project when I try to package my game. Here is the crash as detailed by the Log:

UATHelper: Packaging (Windows (64-bit)): Cook: LogMemory:Warning: Freeing 33554432 bytes from backup pool to handle out of memory.
UATHelper: Packaging (Windows (64-bit)): Cook: LogMemory:Warning: MemoryStats:
UATHelper: Packaging (Windows (64-bit)): Cook:     AvailablePhysical 4489715712
UATHelper: Packaging (Windows (64-bit)): Cook:      AvailableVirtual 140735041249280
UATHelper: Packaging (Windows (64-bit)): Cook:          UsedPhysical 1951092736
UATHelper: Packaging (Windows (64-bit)): Cook:      PeakUsedPhysical 2126536704
UATHelper: Packaging (Windows (64-bit)): Cook:           UsedVirtual 1889468416
UATHelper: Packaging (Windows (64-bit)): Cook:       PeakUsedVirtual 2072518656
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: begin: stack for UAT
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: === Critical error: ===
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: 
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: Fatal error: [File:D:\Build\++UE4+Release-4.16+Compile\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 174] 
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: Ran out of memory allocating 18446744070340949812 bytes with alignment 0
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: 
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: 
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: KERNELBASE.dll!0x00000000041C9E08
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Core.dll!FOutputDeviceWindowsError::Serialize() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:120]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Core.dll!FOutputDevice::Logf__VA() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\misc\outputdevice.cpp:70]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Core.dll!FDebug::AssertFailed() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:349]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Core.dll!FGenericPlatformMemory::OnOutOfMemory() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\genericplatform\genericplatformmemory.cpp:175]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Core.dll!FMallocTBB::Realloc() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\hal\malloctbb.cpp:117]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-RawMesh.dll!TArray<int,FDefaultAllocator>::ResizeTo() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\containers\array.h:2288]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-RawMesh.dll!operator<<() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\containers\array.h:1110]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-RawMesh.dll!operator<<() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\rawmesh\private\rawmesh.cpp:200]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-RawMesh.dll!FRawMeshBulkData::LoadRawMesh() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\rawmesh\private\rawmesh.cpp:253]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-MeshUtilities.dll!FStaticMeshUtilityBuilder::GatherSourceMeshesPerLOD() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\meshutilities\private\meshutilities.cpp:3036]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-MeshUtilities.dll!FMeshUtilities::BuildStaticMesh() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\meshutilities\private\meshutilities.cpp:3448]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Engine.dll!FStaticMeshRenderData::Cache() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\engine\private\staticmesh.cpp:1284]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Engine.dll!UStaticMesh::CacheDerivedData() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\engine\private\staticmesh.cpp:2199]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Engine.dll!UStaticMesh::PostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\engine\private\staticmesh.cpp:2563]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-CoreUObject.dll!UObject::ConditionalPostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:952]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Engine.dll!UBodySetup::PostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\engine\private\physicsengine\bodysetup.cpp:890]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-CoreUObject.dll!UObject::ConditionalPostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:952]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-CoreUObject.dll!EndLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1535]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-CoreUObject.dll!LoadPackageInternal() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1289]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-CoreUObject.dll!LoadPackage() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1377]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-UnrealEd.dll!UCookOnTheFlyServer::TickCookOnTheSide() [d:\build\++ue4+release-4.16+compile\sync\engine\source\editor\unrealed\private\cookontheflyserver.cpp:1526]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-UnrealEd.dll!UCookCommandlet::CookByTheBook() [d:\build\++ue4+release-4.16+compile\sync\engine\source\editor\unrealed\private\commandlets\cookcommandlet.cpp:926]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-UnrealEd.dll!UCookCommandlet::Main() [d:\build\++ue4+release-4.16+compile\sync\engine\source\editor\unrealed\private\commandlets\cookcommandlet.cpp:589]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Cmd.exe!FEngineLoop::PreInit() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2070]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Cmd.exe!GuardedMain() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launch.cpp:127]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Cmd.exe!GuardedMainWrapper() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Cmd.exe!WinMain() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: UE4Editor-Cmd.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: KERNEL32.DLL!0x00000000077A2774
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: ntdll.dll!0x00000000078C0D51
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: ntdll.dll!0x00000000078C0D51
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: 
UATHelper: Packaging (Windows (64-bit)): Cook: LogWindows:Error: end: stack for UAT
UATHelper: Packaging (Windows (64-bit)): CommandUtils.Run: Run: Took 549.025888s to run UE4Editor-Cmd.exe, ExitCode=3
UATHelper: Packaging (Windows (64-bit)): Project.Cook: Cook failed. Deleting cooked data.
UATHelper: Packaging (Windows (64-bit)): Program.Main: ERROR: AutomationTool terminated with exception: AutomationTool.AutomationException: Cook failed. ---> AutomationTool.CommandletException: BUILD FAILED: Failed while running Cook for X:\Raxs Slayer\Games Development\Projects\Labyrinth 4.16\Labyrinth_TheRockMaw.uproject; see log C:\Users\Raxs Slayer\AppDa
ta\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.16\Cook-2017.08.12-17.29.51.txt
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters)
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UE4Exe, String[] Maps, String[] Dirs, String InternationalizationPreset, String[] CulturesToCook, String TargetPlatform, String Parameters)
UATHelper: Packaging (Windows (64-bit)):    at Project.Cook(ProjectParams Params)
UATHelper: Packaging (Windows (64-bit)):    --- End of inner exception stack trace ---
UATHelper: Packaging (Windows (64-bit)):    at Project.Cook(ProjectParams Params)
UATHelper: Packaging (Windows (64-bit)):    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
UATHelper: Packaging (Windows (64-bit)):    at BuildCookRun.ExecuteBuild()
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.BuildCommand.Execute()
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.Automation.Process(String[] Arguments)
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.Program.MainProc(Object Param)
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param)
UATHelper: Packaging (Windows (64-bit)):    at AutomationTool.Program.Main()
UATHelper: Packaging (Windows (64-bit)): Program.Main: AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults:Error: Error Unknown Cook Failure
LogHttp:Warning: 0000022C8820EE00: request failed, libcurl error: 6 (Couldn't resolve host name)
LogHttp:Warning: 0000022C8820EE00: libcurl info message cache 0 (Connection 224 seems to be dead!)
LogHttp:Warning: 0000022C8820EE00: libcurl info message cache 1 (Closing connection 224)
LogHttp:Warning: 0000022C8820EE00: libcurl info message cache 2 (TLSv1.2 (OUT), TLS alert, Client hello (1):)
LogHttp:Warning: 0000022C8820EE00: libcurl info message cache 3 (Could not resolve host: datarouter.ol.epicgames.com)
LogHttp:Warning: 0000022C8820EE00: libcurl info message cache 4 (Closing connection 225)
LogHttp:Warning: 0000022ECF0AD300: request failed, libcurl error: 6 (Couldn't resolve host name)
LogHttp:Warning: 0000022ECF0AD300: libcurl info message cache 0 (Could not resolve host: datarouter.ol.epicgames.com)
LogHttp:Warning: 0000022ECF0AD300: libcurl info message cache 1 (Closing connection 226)

Anyone got any clues?

I can expand on the issue as I have now noticed that this cook error always occurs after “Saving my Main Menu”, which is the smallest scene in my entire game.

UATHelper: Packaging (Windows (64-bit)): Cook: LogCook:Display: Cooking /Game/Labyrinth_Assets/MainMenu -> X:/<<<HardDriveSource Is Here>>>/MainMenu.uasset
4.16/Saved/Cooked/WindowsNoEditor/Labyrinth_TheRockMaw/Content/Labyrinth_Assets/MainMenu.uasset
UATHelper: Packaging (Windows (64-bit)): Cook: LogSavePackage:Display: Finished SavePackage X:/<<<HardDriveSource Is Here>>>/MainMenu.uasset
UATHelper: Packaging (Windows (64-bit)): Cook: LogMemory:Warning: Freeing 33554432 bytes from backup pool to handle out of memory.

Could it be that this main manu uasset has gotten corrupted over time? (source control issues, etc?).
Is it possible to try the build and exclude the main menu from the cooked files, then see if it finishes.
If it does, replacing the main menu with a different asset to see if you can do without?

Just a thought you may have already tried. Cooking can be such a pain sometimes.

Hi, thanks for the response. I looked into it and I can’t seem to find a way to isolate the main menu from the build. For the record, the main menu does work fine and frankly never gives me errors otherwise, but it seams reasonable to suspect it as a potential cause of the issue.

Would you happen to know a way of excluding it from the build? or will I be required to wipe it from the project after making a backup?