Skip to content

Explain activation conflicts caused by a Gemfile require - #10109

Merged
hsbt merged 2 commits into
ruby:masterfrom
hsbt:explain-gemfile-activation
Nov 20, 2026
Merged

hsbt merged 2 commits into
ruby:masterfrom
hsbt:explain-gemfile-activation

Conversation

@hsbt

@hsbt hsbt commented Nov 20, 2026

Copy link
Copy Markdown
Member

When a require in the Gemfile activates a conflicting gem, Bundler suggests prepending bundle exec even if the command already uses it. For a default gem, Bundler suggests removing the dependency or updating Bundler.

Point to the Gemfile when its evaluation activated the conflicting version, including through a dependency. If a require in the Gemfile loads the gem, suggest removing it or moving it into application code after Bundler.setup.

Fixes #7178.

A Gemfile can activate a gem through a transitive dependency before Bundler sets up the locked version. The resulting error suggests using `bundle exec` even when the command already uses it.
Using a fixture default gem directory hides the default Bundler spec. With system RubyGems, requiring bundler/setup can then load the copy shipped with Ruby before the example reaches the activation conflict.
@hsbt
hsbt merged commit 44c5091 into ruby:master Nov 20, 2026
114 checks passed
@hsbt hsbt added the skip old stable Leave out of releases on the old stable line label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bundler: bug fix skip old stable Leave out of releases on the old stable line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundler should give a better error when the Gemfile itself activates a conflicting gem

1 participant