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
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: