Skip to content
Latchkey

Bundler --without Group Still Required at Runtime in CI

You excluded a Gemfile group with --without (or BUNDLE_WITHOUT) to slim the install, but code in this job still requires a gem from that group. Bundler installed everything except what the job actually needs.

What this error means

After bundle install --without development:test, a later step that needs one of those gems fails to load it. The exclusion persisted in .bundle/config, so even a subsequent plain install keeps skipping the group.

bundler output
bundle install --without development test
# ... later ...
Gem::LoadError: rspec is not part of the bundle. Add it to your Gemfile.

Common causes

Excluded a group the job still needs

A test job that excluded the :test group cannot load the test gems. The exclusion was too broad for what this job does.

BUNDLE_WITHOUT persisted in .bundle/config

bundle install --without writes the exclusion into .bundle/config, so it sticks for every later bundle command - including ones you expect to install the full set.

How to fix it

Do not exclude a group this job uses

Scope the exclusion to jobs that genuinely do not need the group.

Terminal
# test job: install the test group
bundle config set --local without 'development'
bundle install
bundle exec rspec

Clear a persisted exclusion

Reset the without setting if a previous step left it in .bundle/config.

Terminal
bundle config unset without
# or
bundle config set --local without ''
bundle install

How to prevent it

  • Exclude groups only in jobs that truly do not need them.
  • Check .bundle/config for a persisted without setting in CI.
  • Prefer per-job without settings over a global exclusion.

Related guides

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