puppetlabs/puppet · error · Puppet::Error

In %{attr}, expected extension record %{index} to have two o

Error message

In %{attr}, expected extension record %{index} to have two or three items, but found %{count}

What it means

Error "In %{attr}, expected extension record %{index} to have two or three items, but found %{count}" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/ssl/certificate_request.rb:168

    index = -1
    extensions.map do |ext_values|
      index += 1

      value = ext_value_to_ruby_value(ext_values)

      # OK, turn that into an extension, to unpack the content.  Lovely that
      # we have to swap the order of arguments to the underlying method, or
      # perhaps that the ASN.1 representation chose to pack them in a
      # strange order where the optional component comes *earlier* than the
      # fixed component in the sequence.
      case ext_values.length
      when 2
        { "oid" => ext_values[0].value, "value" => value }
      when 3
        { "oid" => ext_values[0].value, "value" => value, "critical" => ext_values[1].value }
      else
        raise Puppet::Error, _("In %{attr}, expected extension record %{index} to have two or three items, but found %{count}") % { attr: attribute.oid, index: index, count: ext_values.length }
      end
    end
  end

  def subject_alt_names
    @subject_alt_names ||= request_extensions
                           .select { |x| x["oid"] == "subjectAltName" }
                           .map { |x| x["value"].split(/\s*,\s*/) }
                           .flatten
                           .sort
                           .uniq
  end

  # Return all user specified attributes attached to this CSR as a hash. IF an
  # OID has a single value it is returned as a string, otherwise all values are
  # returned as an array.
  #
  # The format of CSR attributes is specified in PKCS#10/RFC 2986

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/ssl/certificate_request.rb:168 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/f5289957fec0f306. Report an issue: GitHub.