puppetlabs/puppet · error · Puppet::DevError
you must specify title patterns when there are two or more…
Error message
you must specify title patterns when there are two or more key attributes
What it means
ResourceTypeImpl init: the type declares two or more key_attributes (namevars) but no title_patterns, leaving Puppet unable to derive a title from the attributes.
Solutions
- Declare title_patterns in the type definition mapping the title to the key attributes
- Reduce to a single key attribute
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/puppet/pops/resource/resource_type_impl.rb:167 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/9364076a427763ab.
Report an issue: GitHub.
Appendix: source
Thrown at lib/puppet/pops/resource/resource_type_impl.rb:167
# Here it is silently ignored.
nil
when 1
if @title_patterns_hash.nil?
[[/(.*)/m, [[@key_attributes.first]]]]
else
# TechDebt: The case of having one namevar and an empty title patterns is unspecified behavior in puppet.
# Here, it may lead to an empty map which may or may not trigger the wanted/expected behavior.
#
@title_patterns_hash.map { |k, v| [k, v.map { |n| [n.to_sym] }] }
end
else
if @title_patterns_hash.nil? || @title_patterns_hash.empty?
# TechDebt: While title patterns must be specified when more than one is used, they do not have
# to match/set them all since some namevars can be omitted (to support the use case in
# the 'package' type where 'provider' attribute is handled as part of the key without being
# set from the title.
#
raise Puppet::DevError, _("you must specify title patterns when there are two or more key attributes")
end
@title_patterns_hash.nil? ? [] : @title_patterns_hash.map { |k, v| [k, v.map { |n| [n.to_sym] }] }
end
end
# Override CompilableResource inclusion
def is_3x_ruby_plugin?
false
end
# Answers if the parameter name is a parameter/attribute of this type
# This is part of the Puppet::Type API
# Check if used when compiling (it is triggered in an apply)
#
def valid_parameter?(name)
@attributes.include?(name) || METAPARAMSET.include?(name)
endView on GitHub (pinned to e227c27540)