ruby/rubygems · error · Gem::GemNotFoundException

can't find gem #{dep} with executable #{exec_name}

Error message

can't find gem #{dep} with executable #{exec_name}

What it means

Error "can't find gem #{dep} with executable #{exec_name}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems.rb:266

  def self.find_spec_for_exe(name, exec_name, requirements)
    raise ArgumentError, "you must supply exec_name" unless exec_name

    dep = Gem::Dependency.new name, requirements

    loaded = Gem.loaded_specs[name]

    return loaded if loaded && dep.matches_spec?(loaded)

    specs = dep.matching_specs(true)

    specs = specs.find_all do |spec|
      spec.executables.include? exec_name
    end if exec_name

    unless spec = specs.first
      msg = "can't find gem #{dep} with executable #{exec_name}"
      raise Gem::GemNotFoundException, msg
    end

    spec
  end
  private_class_method :find_spec_for_exe

  ##
  # Find and load the full path to the executable for gem +name+.  If the
  # +exec_name+ is not given, an exception will be raised, otherwise the
  # specified executable's path is returned.  +requirements+ allows
  # you to specify specific gem versions.
  #
  # A side effect of this method is that it will activate the gem that
  # contains the executable.
  #
  # This method should *only* be used in bin stub files.

  def self.activate_and_load_bin_path(name, exec_name = nil, *requirements)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems.rb:266 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/e39f64a6c7dd14e5. Report an issue: GitHub.