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

#{full_name} in #{@gem} is corrupt

Error message

#{full_name} in #{@gem} is corrupt

What it means

Error "#{full_name} in #{@gem} is corrupt" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/package/old.rb:79

      # install_location expects an already-resolved destination dir
      destination_dir = File.realpath(destination_dir)

      header.each do |entry|
        full_name = entry["path"]

        destination = install_location full_name, destination_dir

        file_data = String.new

        read_until_dashes io do |line|
          file_data << line
        end

        file_data = file_data.strip.unpack1("m")
        file_data = Zlib::Inflate.inflate file_data

        raise Gem::Package::FormatError, "#{full_name} in #{@gem} is corrupt" if
          file_data.length != entry["size"].to_i

        FileUtils.mkdir_p File.dirname(destination), mode: dir_mode && 0o755

        verify_extraction_dir File.dirname(destination), destination_dir

        FileUtils.rm_rf destination

        File.open destination, "wb", file_mode(entry["mode"]) do |out|
          out.write file_data
        end

        verbose destination
      end
    end
  rescue Zlib::DataError
    raise Gem::Exception, errstr
  end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Re-download the gem; the named entry is corrupt
  2. Rebuild the gem if you created it

When it happens

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