Had this error when building on azure agent machine:
Build command log
Log.WriteException: ==============================================================================
Log.WriteException: ERROR: Cook failed.
Log.WriteException: (see C:\Users\dev\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.27\Log.txt for full exception trace)
Log.WriteException:
Log.WriteException: CommandletException: Editor terminated with exit code 1 while running Cook for D:\agent\_work\7\s\MyProj\MyProj.uproject; see log C:\Users\dev\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.27\Cook-2022.09.14-16.05.48.txt
Log.WriteException: w AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters, String& DestLogFile, Int32 ErrorLevel) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:wiersz 426
Log.WriteException: w AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters, Int32 ErrorLevel) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:wiersz 238
Log.WriteException: w AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UE4Exe, String[] Maps, String[] Dirs, String InternationalizationPreset, String[] CulturesToCook, String TargetPlatform, String Parameters) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:wiersz 89
Log.WriteException: w Project.Cook(ProjectParams Params) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:wiersz 266Wrapped by AutomationException: Cook failed.
Log.WriteException: w Project.Cook(ProjectParams Params) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:wiersz 278
Log.WriteException: w BuildCookRun.DoBuildCookRun(ProjectParams Params) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:wiersz 206
Log.WriteException: w BuildCookRun.ExecuteBuild() w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:wiersz 39
Log.WriteException: w AutomationTool.BuildCommand.Execute() w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:wiersz 263
Log.WriteException: w AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:wiersz 547
Log.WriteException: w AutomationTool.Automation.Process(String[] Arguments, StartupTraceListener StartupListener) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:wiersz 511
Log.WriteException: w AutomationTool.Program.MainProc(String[] Arguments, StartupTraceListener StartupListener) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Program.cs:wiersz 175
Log.WriteException: w AutomationTool.Program.<>c__DisplayClass1_0.<Main>b__2() w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Program.cs:wiersz 87
Log.WriteException: w AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:wiersz 739
Log.WriteException: w AutomationTool.Program.Main(String[] Arguments) w D:\Build\++UE4\Sync\Engine\Source\Programs\AutomationTool\Program.cs:wiersz 87
Log.WriteException: ==============================================================================
Program.Main: AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
with this command:
"C:\Program Files\Epic Games\UE_4.27\Engine\Build\BatchFiles\RunUAT" BuildCookRun -nocompileeditor -installed -nop4 -project="D:\agent\_work\7\s\MyProj\MyProj.uproject" -cook -stage -archive -archivedirectory="D:\agent\_work\7\b" -package -ue4exe="C:\Program Files\Epic Games\UE_4.27\Engine\Binaries\Win64\UE4Editor-Cmd.exe" -compressed -SkipCookingEditorContent -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -target="MyProj" -clientconfig=Development -utf8output
Details in Cook log:
LogPython: Using Python 3.7.7
LogModuleManager: Warning: ModuleManager: Unable to load module 'MyProj' - 0 instances of that module name found.
Message dialog closed, result: Ok, title: Message, text: The game module 'MyProj' could not be found. Please ensure that this module exists and that it is compiled.
LogCore: Engine exit requested (reason: EngineExit() was called)
LogExit: Preparing to exit.
But it only failed on agent machine. I could successfuly build with the same script(updated paths) on my local machine. Also could package and build game when manually opened editor on agent machine.
Finally build and cooking was successful with this command:
"C:\Program Files\Epic Games\UE_4.27\Engine\Build\BatchFiles\RunUAT" BuildCookRun -project="D:\agent\_work\7\s\MyProj\MyProj.uproject" -windows-noeditor -cook -stage -archive -archivedirectory="D:\agent\_work\7\b" -package -ue4exe="C:\Program Files\Epic Games\UE_4.27\Engine\Binaries\Win64\UE4Editor-Cmd.exe" -compressed -SkipCookingEditorContent -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -target="MyProj" -clientconfig=Development -utf8output