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

#{algorithm} checksum mismatch for #{file_name}

Error message

#{algorithm} checksum mismatch for #{file_name}

What it means

Error "#{algorithm} checksum mismatch for #{file_name}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/package.rb:688

    return if real_dir == destination_dir ||
              normalize_path(real_dir).start_with?(normalize_path(destination_dir + "/"))

    raise Gem::Package::PathError.new(real_dir, destination_dir)
  end

  ##
  # Verifies the +checksums+ against the +digests+.  This check is not
  # cryptographically secure.  Missing checksums are ignored.

  def verify_checksums(digests, checksums) # :nodoc:
    return unless checksums

    checksums.sort.each do |algorithm, gem_digests|
      gem_digests.sort.each do |file_name, gem_hexdigest|
        computed_digest = digests[algorithm][file_name]

        unless computed_digest.hexdigest == gem_hexdigest
          raise Gem::Package::FormatError.new \
            "#{algorithm} checksum mismatch for #{file_name}", @gem
        end
      end
    end
  end

  ##
  # Verifies +entry+ in a .gem file.

  def verify_entry(entry)
    file_name = entry.full_name
    @files << file_name

    case file_name
    when /\.sig$/ then
      @signatures[$`] = limit_read(entry, file_name, 1024 * 1024) if @security_policy
      return
    else

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Re-download the gem from the source; its checksum does not match
  2. If the mirror is stale, switch sources or wait for it to sync

When it happens

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