Skip to content
Latchkey

Dart pub "version solving failed" in CI

The pub solver could not find a set of package versions satisfying every constraint. Two packages disagree on a shared dependency, or the SDK bound excludes valid versions.

What this error means

pub get fails with version solving failed, explaining which constraints conflict. It is deterministic given pubspec.yaml and the SDK version.

dart
Because app depends on http ^1.2.0 and foo depends on http ^0.13.0,
version solving failed.
The current Dart SDK version is 3.4.0.

Common causes

Conflicting package constraints

Two dependencies require incompatible ranges of a shared package, so no version satisfies both.

SDK constraint mismatch

A package requires a Dart/Flutter SDK newer or older than the one on the runner.

How to fix it

Resolve the conflicting constraint

  1. Read which two packages disagree on which shared dependency.
  2. Upgrade the lagging package or relax your own bound.
  3. Run dart pub get again to confirm.

Match the SDK version

Set an SDK constraint that fits the runner, or use the SDK the packages require.

pubspec.yaml
environment:
  sdk: ">=3.3.0 <4.0.0"

Inspect why a constraint is forced

See which dependency pins the troublesome range.

CI step
dart pub deps
dart pub get --verbosity=all

How to prevent it

  • Keep dependency ranges compatible.
  • Pin the SDK version in CI to match pubspec.
  • Commit a pubspec.lock for reproducibility.

Related guides

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