CompileAssetCatalogVariant failed with nonzero exit code.

I'm running in a very very very weird error. I have a large asset catalog, consisting of about 2700 assets for 1.19GB of size.

I can successfully build and run my project with both release and debug scheme, when a real device or simulator is selected. However, whenever I select Any iOS device (arm64), about 80ish seconds in the build process, the building fails with the following output:

CoreUI: Error: unable to add asset to store
*** Terminating app due to uncaught exception 'IBPlatformToolFailureException', reason: 'The tool closed the connection (AssetCatalogSimulatorAgent)

What I tried and failed:

  • Cleaning DerivedData and restarting PC
  • Building the same project on three different devices, each with a different version of XCode. All failed.
  • running sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
  • Scanning for duplicate image files, found none.
  • Scanning for duplicate .imageset folders in different folders, found none.
  • Scanning for images that declared a different format than theirs, eg .webp renamed as .png, and found none.
  • Creating an empty Hello World project, and just adding my asset catalog. Build fails for Any iOS device, succeeds for simulator or physical device.
  • Uninstalling and reinstalling XCode command line tools.
  • Manually compiling via actools.
  • Changed "Embed Assets Pack in Product Bundle" from No to Yes.
  • I don't have any .svg file in my assets.

What I tried and failed but gives more insight:

Now the only thing that I was able to come up with was deleting folders to narrow down where the problem was. So I found that there is a 700MB folder called T, containing T1, T2, ..., T6. Eventually managed to narrow down even more to T3, T4, T6.

I created a distinct .xcassets catalog for each subfolder and tried to compile individually with actools, along with assets.xcassets (the main one). Here's the thing:

  • T3.xcassets + assets.xcassets compiles
  • T4.xcassets + assets.xcassets compiles
  • T6.xcassets + assets.xcassets compiles
  • T3.xcassets + T4.xcassets + assets.xcassets compiles.
  • T3.xcassets + T6.xcassets + assets.xcassets compiles.
  • T4.xcassets + T6.xcassets + assets.xcassets compiles.
  • T3.xcassets + T4.xcassets + T6.xcassets + assets.xcassets crashes with CoreUI: Error: unable to add asset to store.

I've been stuck for days now and can't deploy my finished app I worked on for the last three years because of this.

By further investigation it looks like hitting >800MB in size, even split across multiple .xcassets files, immediately triggers the error. Though, I couldn't find anything mentioning an hard limit on assets file size, only thing I could find was <=4GB cap on bundle size, which I don't even remotely hit.

CompileAssetCatalogVariant failed with nonzero exit code.
 
 
Q