puppetlabs/puppet · error · ArgumentError

The type name cannot be a #{type_name.class.name}

Error message

The type name cannot be a #{type_name.class.name}

What it means

Error "The type name cannot be a #{type_name.class.name}" thrown in puppetlabs/puppet.

Source

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

  # or empty name is compatible with any other PResourceType.  A PResourceType
  # with a given name is only compatible with a PResourceType with the same
  # name.  (There is no resource-type subtyping in Puppet (yet)).
  #
  def self.resource(type_name = nil, title = nil)
    case type_name
    when PResourceType
      PResourceType.new(type_name.type_name, title)
    when String
      type_name = TypeFormatter.singleton.capitalize_segments(type_name)
      raise ArgumentError, "Illegal type name '#{type_name}'" unless type_name =~ Patterns::CLASSREF_EXT

      PResourceType.new(type_name, title)
    when nil
      raise ArgumentError, 'The type name cannot be nil, if title is given' unless title.nil?

      PResourceType::DEFAULT
    else
      raise ArgumentError, "The type name cannot be a #{type_name.class.name}"
    end
  end

  # Produces PClassType with a string class_name.  A PClassType with
  # nil or empty name is compatible with any other PClassType.  A
  # PClassType with a given name is only compatible with a PClassType
  # with the same name.
  #
  def self.host_class(class_name = nil)
    if class_name.nil?
      PClassType::DEFAULT
    else
      PClassType.new(class_name.sub(/^::/, ''))
    end
  end

  # Produces a type for Array[o] where o is either a type, or an instance for
  # which a type is inferred.

View on GitHub (pinned to e227c27540)

When it happens

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