ruby/rubygems · error · Gem::GemNotFoundException

unable to find #{gemspec} for gem #{name}

Error message

unable to find #{gemspec} for gem #{name}

What it means

Error "unable to find #{gemspec} for gem #{name}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/resolver/vendor_set.rb:40

  attr_reader :specs # :nodoc:

  def initialize # :nodoc:
    super()

    @directories = {}
    @specs       = {}
  end

  ##
  # Adds a specification to the set with the given +name+ which has been
  # unpacked into the given +directory+.

  def add_vendor_gem(name, directory) # :nodoc:
    gemspec = File.join directory, "#{name}.gemspec"

    spec = Gem::Specification.load gemspec

    raise Gem::GemNotFoundException,
          "unable to find #{gemspec} for gem #{name}" unless spec

    spec.full_gem_path = File.expand_path directory

    @specs[spec.name]  = spec
    @directories[spec] = directory

    spec
  end

  ##
  # Returns an Array of VendorSpecification objects matching the
  # DependencyRequest +req+.

  def find_all(req)
    @specs.values.select do |spec|
      req.match? spec
    end.map do |spec|

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Run `gem build <name>.gemspec` in the vendored gem directory to produce the .gem file
  2. Check that the vendored path actually contains the gem's gemspec

When it happens

Trigger: Thrown at lib/rubygems/resolver/vendor_set.rb:40 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/e5f21287734ebb33. Report an issue: GitHub.