ruby/rubygems · error · Gem::VerificationError

missing gem file #{gem_path}

Error message

missing gem file #{gem_path}

What it means

Error "missing gem file #{gem_path}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/validator.rb:88

      gem_name      = spec.file_name
      gem_path      = spec.cache_file
      spec_path     = spec.spec_file
      gem_directory = spec.full_gem_path

      unless File.directory? gem_directory
        errors[gem_name][spec.full_name] =
          "Gem registered but doesn't exist at #{gem_directory}"
        next
      end

      unless File.exist? spec_path
        errors[gem_name][spec_path] = "Spec file missing for installed gem"
      end

      begin
        unless File.readable?(gem_path)
          raise Gem::VerificationError, "missing gem file #{gem_path}"
        end

        good, gone, unreadable = nil, nil, nil, nil

        File.open gem_path, Gem.binary_mode do |_file|
          package = Gem::Package.new gem_path

          good, gone = package.contents.partition do |file_name|
            File.exist? File.join(gem_directory, file_name)
          end

          gone.sort.each do |path|
            errors[gem_name][path] = "Missing file"
          end

          good, unreadable = good.partition do |file_name|
            File.readable? File.join(gem_directory, file_name)
          end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Reinstall the gem; the cached .gem file is missing
  2. Run `gem pristine <name>` to restore it from the source

When it happens

Trigger: Thrown at lib/rubygems/validator.rb:88 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/7910cddd13e43552. Report an issue: GitHub.