Unknown Cook Error on First Packaging Attempt

Whenever I try to package my project, the first attempt always fails with Unknown Cook Error.

If I immediately try to package again, it works fine without changing anything.

I’ve attached my build log.txt for reference.
Does anyone know why this might be happening or how I can fix it?

Thanks in advance!

Log.txt (323.5 KB)

Hey there @Walon1998! The first attempt failing sounds like you might be having some issues with how many resources the cook process takes first or it could be tripping over prebuilt data.

For example the build is reflecting failure:

Took 448,53s to run UnrealEditor-Cmd.exe, ExitCode=3

But cooking the assets seemed to succeed.

LogInit: Display:
LogInit: Display: Success - 0 error(s), 7 warning(s)
LogInit: Display:

and

LogCook: Display: Cooked packages 12309 Packages Remain 0 Total 12309

So my guess is that the asset cooking is taking so long/too many resources on fresh builds. You may be able to pre-cook assets in engine before going through the full build process to mitigate this:

Are you wiping the DerivedDataCache, Saved, and Intermediate folders between large changes to builds?