Assertion failed during app build

Running Xcode 10.1’s command line tools on macOS 10.13.6. When building a bundle, I'm getting the following error:


Assertion failed: (sizeBack == listSize), function _has_code_signature_extended_attribute, file /Library/Caches/com.apple.xbs/Sources/XCBuild/XCBuild-14460.14/XCBCSupport/PbxCp.mm, line 727.


and I'm stuck trying to fix it.


What I've tried:

  1. Restarting my Mac.
  2. Clearing the Xcode cache.
  3. Really clearing the Xcode cache by nuking the DerivedData directory.
  4. Really really clearing the Xcode cache by removing the org.llvm.clang/ModuleCache directory from /var/folders/**.
  5. Opening the project in Xcode and using its build command. The errors there are the same.
  6. Reinstalling Xcode.

Any ideas what this error even means and how I can resolve it? I can't find any information on "PbxCp.mm" either, so I'm not sure exactly what list size comparison is being made!