Swift Package Manager "failed to resolve dependencies" in CI
SwiftPM could not find a set of package versions that satisfies every requirement in Package.swift. Two dependencies pin incompatible ranges of a shared package, or a required tag does not exist.
What this error means
swift package resolve (or a build that resolves first) fails with "failed to resolve dependencies", naming the conflicting requirements. It is deterministic and reproduces with the same Package.swift/Package.resolved.
error: failed to resolve dependencies:
Dependencies could not be resolved because root depends on 'swift-log' 1.5.0..<2.0.0
and 'metrics-kit' 0.3.0 depends on 'swift-log' 1.0.0..<1.4.0.Common causes
Incompatible version ranges
Two dependencies require non-overlapping versions of a shared package. SwiftPM will not pick one arbitrarily - it reports the conflict.
A missing or moved tag
A dependency pinned .exact() to a tag that was deleted or never published cannot be resolved anywhere SwiftPM looks.
How to fix it
Read the conflict and relax a range
- Identify the shared package and the two conflicting requirements in the message.
- Loosen your own
.upToNextMajor/.exactrequirement so the ranges overlap. - If two third-party packages conflict, upgrade the lagging one to a release that accepts the newer shared dependency.
Re-resolve verbosely
Resolve on its own with verbose output to see the full constraint graph.
swift package resolve --verbose
swift package show-dependenciesHow to prevent it
- Use version ranges rather than
.exact()pins where possible. - Commit
Package.resolvedso resolution is reproducible. - Upgrade related packages together to keep shared deps compatible.