ruby/rubygems · error · GemspecError

The gemspec for #{full_name} at #{loaded_from} was missing o

Error message

The gemspec for #{full_name} at #{loaded_from} was missing or broken. Try running `gem pristine #{name} -v #{version}` to fix the cached spec.

What it means

Error "The gemspec for #{full_name} at #{loaded_from} was missing or broken. Try running `gem pristine #{name} -v #{version}` to fix the cached spec." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/stub_specification.rb:135

      stub.raw_require_paths
    end

    def inspect
      "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
    end

    private

    def _remote_specification
      @_remote_specification ||= begin
        rs = stub.to_spec
        if rs.equal?(self) # happens when to_spec gets the spec from Gem.loaded_specs
          rs = Gem::Specification.load(loaded_from)
          Bundler.rubygems.stub_set_spec(stub, rs)
        end

        unless rs
          raise GemspecError, "The gemspec for #{full_name} at #{loaded_from}" \
            " was missing or broken. Try running `gem pristine #{name} -v #{version}`" \
            " to fix the cached spec."
        end

        rs.source = source
        rs.base_dir = stub.base_dir

        rs
      end
    end
  end
end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/stub_specification.rb:135 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/be545b3cd88e1690. Report an issue: GitHub.