puppetlabs/puppet · error · ArgumentError

Only String, Regexp, Pattern-Type, and Regexp-Type are allow

Error message

Only String, Regexp, Pattern-Type, and Regexp-Type are allowed: got '#{re.class}

What it means

Error "Only String, Regexp, Pattern-Type, and Regexp-Type are allowed: got '#{re.class}" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/types/type_factory.rb:292

  def self.pattern(*regular_expressions)
    patterns = regular_expressions.map do |re|
      case re
      when String
        re_t = PRegexpType.new(re)
        re_t.regexp # compile it to catch errors
        re_t

      when Regexp
        PRegexpType.new(re)

      when PRegexpType
        re

      when PPatternType
        re.patterns

      else
        raise ArgumentError, "Only String, Regexp, Pattern-Type, and Regexp-Type are allowed: got '#{re.class}"
      end
    end.flatten.uniq
    PPatternType.new(patterns)
  end

  # Produces the Scalar type
  # @api public
  #
  def self.scalar
    PScalarType::DEFAULT
  end

  # Produces the ScalarData type
  # @api public
  #
  def self.scalar_data
    PScalarDataType::DEFAULT
  end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/types/type_factory.rb:292 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/613c1c64a3703034. Report an issue: GitHub.