Internal Error during project generation

Question or problem

Generation of our project in the CI results in an internal failure in Tuist. If we run the generation manually on the CI agent in the same directory with the same command it succeeds. Also running generation on a developer machine does not throw the error.

Expectation

We expect the project to be generated without error.

Context

  • Tuist version: 4.46.1

This is the error message:

Loading and constructing the graph
It might take a while if the cache is empty
Using cache binaries for the following targets:
Generating workspace XYZ.xcworkspace
Generating project XYZ
Resolving package dependencies using xcodebuild
:heavy_multiplication_x: Error
▌ The ‘xcodebuild’ was interrupted with a signal 6 and message:
▌ ** INTERNAL ERROR: Unable to load workspace '/Users/builder/vsts-agent/work/7/s/XYZ.xcworkspace’ **
▌ Uncaught Exception: *** -[NSMutableArray insertObjects:atIndexes:]: count of array (23) differs from count of index set (22)
▌ Stack:
▌ 0 __exceptionPreprocess (in CoreFoundation)
▌ 1 objc_exception_throw (in libobjc.A.dylib)
▌ 2 -[__NSCFString characterAtIndex:].cold.1 (in CoreFoundation)
▌ 3 -[NSMutableArray insertObjects:atIndexes:] (in CoreFoundation)
▌ 4 __50-[IDEGroup insertGroupSubitems:atIndexes:context:]block_invoke (in IDEFoundation)
▌ 5 -[DVTModelObjectGraph performBlockCoalescingModelChanges:] (in DVTFoundation)
▌ 6 -[IDEGroup insertGroupSubitems:atIndexes:context:] (in IDEFoundation)
▌ 7 -[NSMutableArray(DVTFoundationClassAdditions) dvt_sortedInsertOfObjects:withComparator:] (in DVTFoundation)
▌ 8 specialized IDESPMWorkspaceDelegate.registerDependencyFileReferences(
:modelGraphSynchronizerToken:) (in IDESwiftPackageCore)
▌ 9 specialized IDESPMWorkspaceDelegate.dependencyPackagesDidUpdate(packages:graphHasErrors:revalidatedFilePathCaches:modelGraphSynchronizerToken:) (in IDESwiftPackageCore)
▌ 10 closure #1 in IDESPMWorkspaceDelegate.packageGraphDidFinishAction(
:duration:result:) (in IDESwiftPackageCore)
▌ 11 partial apply for closure #1 in IDESPMWorkspaceDelegate.disableWorkspaceContentSynchronization(during:) (in IDESwiftPackageCore)
▌ 12 <deduplicated_symbol> (in DVTFoundation)
▌ 13 <deduplicated_symbol> (in DVTFoundation)
▌ 14 thunk for @escaping @callee_guaranteed () → () (in DVTFoundation)
▌ 15 __58-[DVTModelObjectGraph performBlockCoalescingModelChanges:]block_invoke (in DVTFoundation)
▌ 16 -[DVTModelGraphTransactionScope performTransaction:] (in DVTFoundation)
▌ 17 -[DVTModelObjectGraph performBlockCoalescingModelChanges:] (in DVTFoundation)
▌ 18 DVTModelObjectGraph.performBlockCoalescingModelChanges(
:slight_smile: (in DVTFoundation)
▌ 19 IDESPMWorkspaceDelegate.disableWorkspaceContentSynchronization(during:) (in IDESwiftPackageCore)
▌ 20 IDESPMWorkspaceDelegate.packageGraphDidFinishAction(:duration:result:) (in IDESwiftPackageCore)
▌ 21 <deduplicated_symbol> (in IDESwiftPackageCore)
▌ 22 SPMWorkspace.packageGraphActionFinished(
:slight_smile: (in SwiftPM)
▌ 23 closure #2 in closure #3 in SPMWorkspace.processPackageGraphActionsInBackgroundIfNeeded(canProcessPackageGraphActions:) (in SwiftPM)
▌ 24 <deduplicated_symbol> (in SwiftPM)
▌ 25 <deduplicated_symbol> (in SwiftPM)
▌ 26 <deduplicated_symbol> (in SwiftPM)
▌ 27 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) (in libswift_Concurrency.dylib)

▌ Sorry this didn’t work. Here’s what to try next:
▌ ▸ If the error is actionable, address it
▌ ▸ If the error is not actionable, let’s discuss it in the Troubleshooting & how to
▌ ▸ If you are very certain it’s a bug, file an issue

Hi @Simon,

Based on the error, xcodebuild is aborting when Tuist uses it to resolve your dependencies and extract the lock file from the project. What happens if you eliminate the dependencies? If it works, could you share with us a small reproducible project?