ruby/rubygems · error · Gem::Package::FormatError

package metadata is missing

Error message

package metadata is missing

What it means

Error "package metadata is missing" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/package.rb:725

      digest entry
    end

    load_spec_from_metadata entry
  rescue StandardError
    warn "Exception while verifying #{@gem.path}"
    raise
  end

  ##
  # Verifies the files of the +gem+

  def verify_files(gem)
    gem.each do |entry|
      verify_entry entry
    end

    unless @spec
      raise Gem::Package::FormatError.new "package metadata is missing", @gem
    end

    unless @files.include? "data.tar.gz"
      raise Gem::Package::FormatError.new \
        "package content (data.tar.gz) is missing", @gem
    end

    if (duplicates = @files.group_by {|f| f }.select {|_k,v| v.size > 1 }.map(&:first)) && duplicates.any?
      raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(", ")})"
    end
  end

  if RUBY_ENGINE == "truffleruby"
    def copy_stream(src, dst, size) # :nodoc:
      dst.write src.read(size)
    end
  else
    def copy_stream(src, dst, size) # :nodoc:

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Rebuild the gem so it contains metadata (metadata.gz)
  2. Re-download the gem from the source if it was truncated

When it happens

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