Unknown Cook Failure: CookCommand.Automation.cs:249 Wrapped by AutomationException: Cook failed.

Hi all,

Our development team has been blocked by this Unknown Cook Failure when packaging for Win64 in the editor for quite a while now and we are really running out of ideas to resolve it. If you google for this issue within the Unreal Forums you will find roughly 8 pages of people struggling with this same vague error. We have pursued a number of avenues to resolve this (highlighted below) but only with marginal success. The issue seems to be resolved when we disable our AWSAPIGateway plugin, which is just the header files and lib/dlls files built from the apigateway part of the aws-cpp-sdk and integrated into Unreal’s build system. We do exactly the same thing for the AWSCore and have no issues. What is really strange is that I must have done 30+ builds with both plugins enabled with exactly the same code interacting with them and had no issues. It just randomly broke. Even weirder is when I rollback our git commits to a time when it was able to build it now gives me the same error. This makes me think that maybe the error is coming from a file git is ignoring.
Attached is the build logs of a failed build with the APIGateway plugin enabled Game_Failure_AfterEngineRebuild.log.txt (349 KB) , the automation tool log from a failed build (from UnrealEngine\Engine\Programs\AutomationTool\Saved\Logs\Log.txt) Game_Failure_UAT_Log.txt (166 KB) , a successful build with the APIGateway plugin disabled (to show that some of the warnings are common in both and have no effect on whether it builds or not) Game_Success_APIGatewayDisabled_AfterEngineAndProjectReClone.log.txt (269 KB) , and the gitignore we are using gitignore.txt (1.26 KB).
I did have to edit the logs slightly for company confidentiality reasons, but all the relevant information should be there.
We are using a source build of UE4.21.2 by the way, as we need to compile dedicated server builds. We are always doing a “Development” package, not “Shipping”. Source Control is git and git lfs.

The best error trace comes from the automation tool log, but we have not had much luck finding the cause of error from it:

Log.WriteException: CommandletException: Editor terminated with exit code -1073741819 while running Cook for C:\MYGAME\MyGame.uproject; see log D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Programs\AutomationTool\Saved\Logs\Cook-2020.02.10-18.22.49.txt
Log.WriteException: at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters, String& DestLogFile) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 424
Log.WriteException: at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 237
Log.WriteException: at AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UE4Exe, String] Maps, String] Dirs, String InternationalizationPreset, String] CulturesToCook, String TargetPlatform, String Parameters) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 89
​Log.WriteException: at Project.Cook(ProjectParams Params) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:line 249Wrapped by AutomationException: Cook failed.
Log.WriteException: at Project.Cook(ProjectParams Params) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:line 263
Log.WriteException: at BuildCookRun.DoBuildCookRun(ProjectParams Params) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 209
Log.WriteException: at BuildCookRun.ExecuteBuild() in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 41
Log.WriteException: at AutomationTool.BuildCommand.Execute() in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 242
Log.WriteException: at AutomationTool.Automation.Execute(List1 CommandsToExecute, Dictionary2 Commands) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 563
Log.WriteException: at AutomationTool.Automation.Process(String] Arguments, StartupTraceListener StartupListener) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 533
Log.WriteException: at AutomationTool.Program.MainProc(String] Arguments, StartupTraceListener StartupListener) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Program.cs:line 173
Log.WriteException: at AutomationTool.Program.<>cDisplayClass1_0.<Main>b2() in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Program.cs:line 99
Log.WriteException: at AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 725
Log.WriteException: at AutomationTool.Program.Main() in D:\Program Files\Unreal-Source-Build\UnrealEngine\Engine\Source\Programs\AutomationTool\Program.cs:line 99
Log.WriteException: ==============================================================================
Program.Main: AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)

What we have tried:

  1. Deleting the “.vs”, “Intermediate”, “Saves”, “Game.sln”, and “DerivedDataCache” files and folders. Then rebuilding the project “DevelopmentEditor” and “DevelopementServer” in VS, booting up editor, hitting the c++ compile button in the editor for good measure, building the maps again, and then packaging. Same error.
  2. Same as above but also deleting the “Config” folder.
  3. Cloning the project to a fresh folder and building from the ground up. Same Error.
  4. Deleting everything in the “Content” folder in the file explorer, recompile editor and server from VS, booting up editor, package… same error.
  5. Setting the APIGateway “LoadingPhase” to “Default”, rather than “PreDefault”. The APIGateway plugin depends on the AWSCore plugin in its Build.cs file so this makes sense. This seemed to solve the issue temporarily for one of our developers when he was building in a project with no content, but the error came back to haunt him.
  6. Resolving the APIGateway’s dependency on AWSCore warning that shows in the build log by adding it to the .uplugin text. Same error.
  7. As mentioned, rolling back to a commit which had the same code and setup for the APIGateway plugin what was packaging many times perfectly previously, now fails to package with the same **** error.
  8. Rolling back to before I added either plugin. It builds fine as expected.
  9. Building a different project with the same unreal source engine binaries, packages fine.
  10. Migrating just the aws plugins + GameServer.Target.cs to a brand new blank c++ project. Failed with same error. So I guess that means the error does not stem from the my C++ code that is interacting with my plugins?
  11. “Rebuilding” the UE4 source engine “DevelopmentEditor” and “DevelopementServer” in VS, then rebuilding the same in the game project. Same error.
  12. Removing all Unreal Engine installs (binary versions and source versions), deleting any trace of Unreal in my AppData. Re-cloning and rebuilding the entire engine, re-cloning and rebuilding our project in a clean folder (again editor and server for both engine and project) and I still get the same error. BUT one of our other developers, who did exactly the same process, doesn’t get the error and packages the project fine with the APIGateway plugin enabled. Soooo… the only thing I can think of is that he has or doesn’t have some file that was not deleted in the removal of the engines, what is not tracked by git, that I do or do not have that somehow causing the the build failure? Maybe it a strange driver, os, or compiler issue that only shows itself when building this plugin and only came into existence after the 30+ times that I built it successfully because it was automatically updated or something?

As you can see, I’m grasping at straws at this point so any help would be very much appreciated.

Thank you!

If anyone is curious, we are still stuck on this.

I tried updating the AWS Plugins by replacing the both the core and api gateway header files with those from AWS’s newest commits and then built the updated lib and dlls with cmake and msbuild. When I built our project in VS with the updated plugins I got a familiar error

'clock_t': is not a member of '`global namespace'' 

at this post’s suggestion I renamed AWS’s Time.h to AWSTime.h which resolved the issue. I then got an unresolved linker error from CONTENT_LENGTH_HEADER, as I was more concerned about rest of the project building I just commented out the code needing it and it built in VS fine (both DevelopmentEditor and DevelopmentServer).
When I opened up the editor and tried to build the map it told me to recompile the UnrealLightmass, I did that in the Unreal Source VS sln, resolved.
Then I compiled the c++ from the editor, and built for Win64 and… same UnknownCookFailure Error.

Again if anyone can help with this I would really appreciate it. Cheers!

Also if anyone has read the logs they may have noticed a BP compiler warning coming from Bomber_BP. It was highly unlikely this would have resolved the error as that warning was there with and without the api gateway plugin enabled and hence when it failed to build and when it built successfully (not to mention the project still fails with no content). However I saw some posts saying similar unknown cook errors were caused by unlinked pins, so why not.
Didn’t work of course, same error.

This post has a similar “CookCommand.Automation.cs:line 249Wrapped by AutomationException: Cook failed.” error, although a lot clearer “UnauthorizedAccessException” error before it. Either way, I tried running the source build of the editor as administrator and building again, but no luck.

In response to this post, I moved source engine to a path without spaces in it and built it again (seemed to rebuild all the modules), recompiled project, and tried packaging. Same error. That would have been a cruel resolution, but would have taken it.

In today’s installment of WylieModro talking to himself about UnknownCookFailure errors, I was rightfully nudged in the direction of reducing possible variables so I have been testing on the blank project mentioned in point 10 above with just the AWS plugins installed. As nothing in the AWS plugins explicitly run on a server I removed GameServer.Target.cs and have just been trying to package the project as a “normal” Win64 game. Tried using a binary version of UE4.22 to built it rather than the source build of UE4.21.2, exactly the same error with the same exception trace for the AutomationTool. That might suggest that the issue has nothing to do with the source build of the engine then.

Tried packaging in Shipping Mode vs the usual Development. Same error. Also starting to edit the actual AutomationTool c# code to try to debug the “CommandletException”. Again if anyone wants to chime in they are more than welcome.

Any luck with this?

I have a similar problem in 4.25 - everything packages fine 4.18-4.24, but 4.25 spits out “AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)”.
Logs give me nothing to work with, no issues with my content.


Took a look at your logs, and this error:

Is straight out of the ShaderCompiler when it just dies unexpectedly. I saw your hardware is running on an Intel HD5600. Have you tried running on something with a better graphics card? You may also want to try running on Win10 rather than 8.1

You could also grab the command line that the UAT is using and run that yourself with the debugger attached to the engine.

Hey all, thanks for following up on this.

The good news is that the issue is solved and I am no longer experiencing it.
The bad news is that I’m not sure what solved it.

What I think I did before it worked:

  • Ran blank project a few times from Ue4 VS soln
  • selected project from unreal editor rather than launching from uproject
  • attached debugger to Ue4 while building
  • had ignored breakpoint in like 517 of ProcessUtils.cs. In Wait For Exit: if (!(bStdOutSignalReceived && bStdErrSignalReceived))
  • did notice it build 87 other libraries before that (went through every single one and they were all built in failed builds also)
  • didn’t build editor or server again in VS before packaging

Hopefully, this can help someone.

Also @ExtraLifeMatt Thank for trying to help. Its strange that Unreal is spitting out that GPU, I have a GTX960M on this machine.

Is this a laptop? It looks like Unreal may be using the integrated card over your 960M. You may want to hop in your BIOS and disable that card, but if you aren’t seeing the issue then I guess carry on. :slight_smile:

Yeah, its a laptop. It can play high-graphics scene in the editor no problem though. I’ll have a look though, thanks!