Skip to content
Latchkey

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.

swift package output
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

  1. Identify the shared package and the two conflicting requirements in the message.
  2. Loosen your own .upToNextMajor/.exact requirement so the ranges overlap.
  3. 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.

Terminal
swift package resolve --verbose
swift package show-dependencies

How to prevent it

  • Use version ranges rather than .exact() pins where possible.
  • Commit Package.resolved so resolution is reproducible.
  • Upgrade related packages together to keep shared deps compatible.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →