It's long standing build pipeline issue from 2022.2 up until 2022.3.2f1 LTS editor, the issue is not fixed yet until now that mostly the first attempt to build player runtime will fail and need to try second attempt or more to get a success build. It will more prompt to fail the build when u try to change reference at prefab and trigger baking at dots project or try to compile code then build the player will also easy to fail the build. 2021.3.x LTS editor has no such issue and always get success player runtime at first attempt.
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) ...```