Skip to content
Latchkey

Bundler "frozen mode" Lockfile Mismatch in CI

Bundler is running with frozen (deployment) mode enabled, which forbids changing Gemfile.lock during install. When the Gemfile and lockfile differ even slightly, the install aborts instead of re-resolving.

What this error means

bundle install fails specifically because frozen/deployment mode is on and the Gemfile.lock would need to change. The message tells you to run bundle install locally and commit the lockfile. It is intentional protection, not a bug.

bundler output
The lockfile does not match the gemfile. Running in deployment mode,
where changes to the Gemfile.lock are not allowed.

You have added to the Gemfile:
* rack (~> 3.0)

Common causes

Deployment mode plus an out-of-date lockfile

CI enables --deployment or sets BUNDLE_FROZEN, which pins the lockfile. Any Gemfile change not reflected in Gemfile.lock then fails the install.

Lockfile generated on a different Bundler or platform

A lockfile produced by a different Bundler version or missing platform entries can differ from what CI expects, tripping frozen mode.

How to fix it

Regenerate the lockfile and commit it

Re-resolve locally without frozen mode, then commit so CI has a matching lockfile.

Terminal
bundle install
git add Gemfile.lock && git commit -m "Sync Gemfile.lock"

Toggle frozen mode deliberately

On a disposable runner where you intend to re-resolve, turn frozen off for that job only.

Terminal
bundle config set frozen false
# or re-enable it explicitly
bundle config set --local frozen true

How to prevent it

  • Commit Gemfile.lock and keep frozen mode on in CI.
  • Re-run bundle install after every Gemfile edit.
  • Standardize the Bundler version across local and CI so lockfiles match.

Related guides

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