Skip to content
Latchkey

Bundler "Could not find compatible versions" in CI

Bundler's resolver could not find a single set of versions that satisfies every requirement at once. Two of your gems demand incompatible versions of a shared dependency.

What this error means

bundle install or bundle update fails with "Could not find compatible versions", listing the gem in conflict and which requirements pull it in opposite directions. It is deterministic. The same Gemfile fails the same way every time.

bundler output
Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    rails (~> 7.1) was resolved to 7.1.0, which depends on
      activesupport (= 7.1.0)

    some-gem was resolved to 2.0.0, which depends on
      activesupport (< 7.0)

Common causes

Two gems pin incompatible shared versions

Gem A needs activesupport (= 7.1.0) while gem B needs activesupport (< 7.0). No single version satisfies both, so the resolver cannot proceed.

An over-tight pin in your Gemfile

A hard version pin you added conflicts with what another gem requires. Loosening your constraint to a compatible range often resolves it.

How to fix it

Read the conflict and relax a constraint

  1. Identify the shared gem and the two incompatible requirements in the output.
  2. Loosen your own pin to a pessimistic range (~>) that overlaps both, if one exists.
  3. If the conflict is between two third-party gems, upgrade the lagging one to a release that accepts the newer shared dependency.

Update just the conflicting gems

A targeted update lets the resolver pick a newer compatible set without churning the whole lockfile.

Terminal
bundle update activesupport some-gem
bundle install

Inspect the dependency tree

See exactly which gems pull in the conflicting dependency.

Terminal
bundle viz   # or
gem dependency activesupport --reverse

How to prevent it

  • Pin with pessimistic ~> ranges, not exact = versions, unless required.
  • Upgrade related gems together so shared dependencies stay compatible.
  • Commit Gemfile.lock so conflicts surface in PRs, not just in CI.

Related guides

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