puppetlabs/puppet · error · ArgumentError
The type name cannot be nil, if title is given
Error message
The type name cannot be nil, if title is given
What it means
TypeFactory.resource was called with a nil type_name while a title was given; a resource reference like Resource[title] without a type cannot be constructed.
Solutions
- Provide the resource type name along with the title
- Pass nil for both arguments to get the universal Resource type
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/puppet/pops/types/type_factory.rb:443 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/5159aeb8de8df804.
Report an issue: GitHub.
Appendix: source
Thrown at lib/puppet/pops/types/type_factory.rb:443
ranges.empty? ? PSemVerType::DEFAULT : PSemVerType.new(ranges)
end
# Produces a PResourceType with a String type_name A PResourceType with a nil
# 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(/^::/, ''))
endView on GitHub (pinned to e227c27540)