ruby/rubygems · error · Gem::Exception

can't find executable #{exec_name} for gem #{gem_name}. #{ge

Error message

can't find executable #{exec_name} for gem #{gem_name}. #{gem_name} is not currently included in the bundle, perhaps you meant to add it to your #{Bundler.default_gemfile.basename}?

What it means

Error "can't find executable #{exec_name} for gem #{gem_name}. #{gem_name} is not currently included in the bundle, perhaps you meant to add it to your #{Bundler.default_gemfile.basename}?" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/rubygems_integration.rb:236

    end

    # Used to give better error messages when activating specs outside of the current bundle
    def replace_bin_path(specs_by_name)
      redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
        exec_name = args.first
        raise ArgumentError, "you must supply exec_name" unless exec_name

        spec_with_name = specs_by_name[gem_name]
        matching_specs_by_exec_name = specs_by_name.values.select {|s| s.executables.include?(exec_name) }
        spec = matching_specs_by_exec_name.delete(spec_with_name)

        unless spec || !matching_specs_by_exec_name.empty?
          message = "can't find executable #{exec_name} for gem #{gem_name}"
          if spec_with_name.nil?
            message += ". #{gem_name} is not currently included in the bundle, " \
                       "perhaps you meant to add it to your #{Bundler.default_gemfile.basename}?"
          end
          raise Gem::Exception, message
        end

        unless spec
          spec = matching_specs_by_exec_name.shift
          warn \
            "Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
            "You should run `bundle binstub #{gem_name}` " \
            "to work around a system/bundle conflict."
        end

        unless matching_specs_by_exec_name.empty?
          conflicting_names = matching_specs_by_exec_name.map(&:name).join(", ")
          warn \
            "The `#{exec_name}` executable in the `#{spec.name}` gem is being loaded, but it's also present in other gems (#{conflicting_names}).\n" \
            "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
            "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
        end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/rubygems_integration.rb:236 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/f1e6ba39cc140621. Report an issue: GitHub.