ruby/rubygems · error · Gem::CommandLineError

Passphrase and passphrase confirmation don't match

Error message

Passphrase and passphrase confirmation don't match

What it means

Error "Passphrase and passphrase confirmation don't match" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/commands/cert_command.rb:174

    cert = Gem::Security.create_cert_email(
      email,
      key,
      Gem::Security::ONE_DAY * expiration_length_days
    )

    Gem::Security.write_certificate cert, "gem-public_cert.pem"
  end

  def build_key # :nodoc:
    return options[:key] if options[:key]

    passphrase = ask_for_password "Passphrase for your Private Key:"
    say "\n"

    passphrase_confirmation = ask_for_password "Please repeat the passphrase for your Private Key:"
    say "\n"

    raise Gem::CommandLineError,
          "Passphrase and passphrase confirmation don't match" unless passphrase == passphrase_confirmation

    algorithm = options[:key_algorithm] || Gem::Security::DEFAULT_KEY_ALGORITHM
    key = Gem::Security.create_key(algorithm)
    key_path = Gem::Security.write_private_key key, "gem-private_key.pem", 0o600, passphrase

    [key, key_path]
  end

  def certificates_matching(filter)
    return enum_for __method__, filter unless block_given?

    Gem::Security.trusted_certificates.select do |certificate, _|
      subject = certificate.subject.to_s
      subject.downcase.index filter
    end.sort_by do |certificate, _|
      certificate.subject.to_a.map {|name, data,| [name, data] }
    end.each do |certificate, path|

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems/commands/cert_command.rb:174 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/80eaee75308b59c7. Report an issue: GitHub.