iOS cannot build - Internal build system error. BuildProgram exited with code 1

Hey all,

I am trying to update an app for iOS. Funnily building for android already worked but iOS is spitting errors which I don’t understand at all.
FYI the previous iOS build worked until I upgraded Unity to 2023.2.20f1.

The first error

Internal build system error. BuildProgram exited with code 1.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at iOSPlayerBuildProgram.SetupTargetForInludedFile(IncludedFile file)
   at iOSPlayerBuildProgram.AddProjectFile(NPath srcPath, NPath dstPath, Boolean addToEmbeddedBinaries, String targetGUID, Boolean shouldAddToProject, Boolean setTarget, SymlinkType symlinkType)
   at iOSPlayerBuildProgram.SetupCopyPlugin(NPath pluginPath, NPath pluginDest, Plugin plugin)+MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupCopyPlugins()
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.<SetupPlayerBuild>b__94_0()
   at Bee.Core.TinyProfiler2Base.Section[T](String label, Func`1 func, Dictionary`2 metadata)
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild()
   at iOSPlayerBuildProgram.SetupPlayerBuild()
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
   at PlayerBuildProgramTypeWrapper.Run(String[] args)
   at Program.Main(String[] args)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

the second error

BuildFailedException: Player build failed: Internal build system error. BuildProgram exited with code 1.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at iOSPlayerBuildProgram.SetupTargetForInludedFile(IncludedFile file)
   at iOSPlayerBuildProgram.AddProjectFile(NPath srcPath, NPath dstPath, Boolean addToEmbeddedBinaries, String targetGUID, Boolean shouldAddToProject, Boolean setTarget, SymlinkType symlinkType)
   at iOSPlayerBuildProgram.SetupCopyPlugin(NPath pluginPath, NPath pluginDest, Plugin plugin)+MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupCopyPlugins()
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.<SetupPlayerBuild>b__94_0()
   at Bee.Core.TinyProfiler2Base.Section[T](String label, Func`1 func, Dictionary`2 metadata)
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild()
   at iOSPlayerBuildProgram.SetupPlayerBuild()
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
   at PlayerBuildProgramTypeWrapper.Run(String[] args)
   at Program.Main(String[] args)
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <8f5ff83e453e49179847370b820a0398>:0)
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <4307642742654d12a6b3f1a6939bfab3>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I’ve searched for these error codes but I’m not getting any decent results.
There’s this thread I found but none of the fix suggestions work ( Unity 2022.3.5 f1 BuildProgram exited with code 1 )

Please help, I really need to get that update out asap :pensive:

Hi, rabu-nee. Are you using .xcframework plugins, by any chance?

i am honestly not sure, there’s quite some assets in the project.
How would I check it?

To be fair, you just need to check if the .xcframework directory in your project is empty or not. Open the Projects tab and search for it. If the directory exists, but there’s only a .meta file, it counts as empty, too. Let me know if that’s the case.

There isn’t.

We’ve downgraded again for the build now but it’d be nice to know why building with 2023.2.20f1 doesn’t work regardless–

I see. Could you then please report the bug via the Bug Reporter (“Help → Report a Bug…” in the Unity Editor)? Make sure to attach the project that you’re having issues with. Our team will then take a deeper look into the situation. Cheers!