Skip to content
Latchkey

Bundler Version Mismatch - Lockfile BUNDLED WITH in CI

The Bundler version recorded in Gemfile.lock under BUNDLED WITH differs from the Bundler installed on the runner. Depending on the versions, Bundler warns, re-resolves, or refuses to run.

What this error means

bundle install warns that the lockfile was bundled with a different Bundler, or errors that you must use a specific Bundler major version. The gems are fine; the Bundler tool version is the mismatch.

bundler output
Warning: the running version of Bundler (2.4.10) is older than the version
that created the lockfile (2.5.6). We suggest you to upgrade to the version
that created the lockfile by running `gem install bundler:2.5.6`.

Common causes

Installed Bundler older than BUNDLED WITH

The lockfile records a newer Bundler than the runner has. Newer lockfile features may not be understood by the older Bundler, prompting a warning or upgrade request.

Bundler major-version gap

A Bundler 1.x lockfile on a Bundler 2.x runner (or the reverse) can be rejected outright with a "must use Bundler N" error.

How to fix it

Install the Bundler the lockfile pins

Match the runner Bundler to BUNDLED WITH.

Terminal
gem install bundler:2.5.6
bundle _2.5.6_ install

Or update the lockfile to the runner Bundler

If you prefer the installed Bundler, refresh BUNDLED WITH and commit.

Terminal
bundle update --bundler
git add Gemfile.lock && git commit -m "Update BUNDLED WITH"

How to prevent it

  • Pin the Bundler version in CI to match BUNDLED WITH.
  • Commit lockfiles produced by a consistent Bundler version.
  • Let setup-ruby install the lockfile’s Bundler automatically (bundler: Gemfile.lock).

Related guides

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