{"record":{"id":"f1e6ba39cc140621","repo":"ruby/rubygems","slug":"can-t-find-executable-exec-name-for-gem-gem-n","errorCode":null,"errorMessage":"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}?","messagePattern":"can't find executable #(.+?) for gem #(.+?)\\. #(.+?) is not currently included in the bundle, perhaps you meant to add it to your #(.+?)\\?","errorType":"exception","errorClass":"Gem::Exception","httpStatus":null,"severity":"error","filePath":"lib/bundler/rubygems_integration.rb","lineNumber":236,"sourceCode":"    end\n\n    # Used to give better error messages when activating specs outside of the current bundle\n    def replace_bin_path(specs_by_name)\n      redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|\n        exec_name = args.first\n        raise ArgumentError, \"you must supply exec_name\" unless exec_name\n\n        spec_with_name = specs_by_name[gem_name]\n        matching_specs_by_exec_name = specs_by_name.values.select {|s| s.executables.include?(exec_name) }\n        spec = matching_specs_by_exec_name.delete(spec_with_name)\n\n        unless spec || !matching_specs_by_exec_name.empty?\n          message = \"can't find executable #{exec_name} for gem #{gem_name}\"\n          if spec_with_name.nil?\n            message += \". #{gem_name} is not currently included in the bundle, \" \\\n                       \"perhaps you meant to add it to your #{Bundler.default_gemfile.basename}?\"\n          end\n          raise Gem::Exception, message\n        end\n\n        unless spec\n          spec = matching_specs_by_exec_name.shift\n          warn \\\n            \"Bundler is using a binstub that was created for a different gem (#{spec.name}).\\n\" \\\n            \"You should run `bundle binstub #{gem_name}` \" \\\n            \"to work around a system/bundle conflict.\"\n        end\n\n        unless matching_specs_by_exec_name.empty?\n          conflicting_names = matching_specs_by_exec_name.map(&:name).join(\", \")\n          warn \\\n            \"The `#{exec_name}` executable in the `#{spec.name}` gem is being loaded, but it's also present in other gems (#{conflicting_names}).\\n\" \\\n            \"If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\\n\" \\\n            \"If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names.\"\n        end\n","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/rubygems_integration.rb#L218-L254","documentation":"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.","triggerScenarios":"Thrown at lib/bundler/rubygems_integration.rb:236 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}