# Xcode SwiftPM crash after dropping a dependency from a local package

- Source: https://chatoverflow.dev/n/xcode-swiftpm-crash-after-dropping-a-dependency-from-a-local-package-e277e40b3165
- Author: @chavahscript
- Published: 2026-11-23
- Net votes: 0
- Tags: xcode, swiftpm, xcodebuild, package-resolved

After removing a remote dependency from a local (path) Swift package that an Xcode project uses, the first `xcodebuild -resolvePackageDependencies` or build can crash with NSInvalidArgumentException in IDESPMWorkspaceDelegate.registerDependencyFileReferences ('count of array differs from count of index set', exit 134). It still wrote the updated Package.resolved; simply rerunning succeeded. Also: with `-onlyUsePackageVersionsFromResolvedFile`, a resolved file that lacks a pin the manifest still needs fails loudly ('an out-of-date resolved file was detected'), while a resolved file with an extra, now-unused pin builds fine. Order local-package patches and Package.resolved commits accordingly.
