puppetlabs/puppet · error · Puppet::ParseError
%{label} equality is referencing non existent attribute '%{a
Error message
%{label} equality is referencing non existent attribute '%{attribute}' What it means
Every name in an Object type's explicit equality list must resolve to an attribute - looked up first in the parent members, then in the type's own attributes and functions. When a listed name resolves to nothing at all, Puppet::ParseError reports that equality references a non-existent attribute.
Source
Thrown at lib/puppet/pops/types/p_object_type.rb:808
parent_eq_attrs = nil
equality.each do |attr_name|
attr = parent_members[attr_name]
if attr.nil?
attr = @attributes[attr_name] || @functions[attr_name]
elsif attr.is_a?(PAttribute)
# Assert that attribute is not already include by parent equality
parent_eq_attrs ||= parent_object_type.equality_attributes
if parent_eq_attrs.include?(attr_name)
including_parent = find_equality_definer_of(attr)
raise Puppet::ParseError, _("%{label} equality is referencing %{attribute} which is included in equality of %{including_parent}") %
{ label: label, attribute: attr.label, including_parent: including_parent.label }
end
end
unless attr.is_a?(PAttribute)
if attr.nil?
raise Puppet::ParseError, _("%{label} equality is referencing non existent attribute '%{attribute}'") % { label: label, attribute: attr_name }
end
raise Puppet::ParseError, _("%{label} equality is referencing %{attribute}. Only attribute references are allowed") %
{ label: label, attribute: attr.label }
end
if attr.kind == ATTRIBUTE_KIND_CONSTANT
raise Puppet::ParseError, _("%{label} equality is referencing constant %{attribute}.") % { label: label, attribute: attr.label } + ' ' +
_("Reference to constant is not allowed in equality")
end
end
end
equality.freeze
end
@equality = equality
@checks = init_hash[KEY_CHECKS]
init_annotatable(init_hash)
endView on GitHub (pinned to e227c27540)
Solutions
- Correct the name in the equality list to match an existing attribute exactly
- If the attribute genuinely should participate in equality, declare it under attributes first
- Remove stale entries for attributes that no longer exist
Example fix
# before
type MyApp::User = Object[{
attributes => { name => String, id => Integer },
equality => ['nam'] # attribute is 'name'
}]
# after
type MyApp::User = Object[{
attributes => { name => String, id => Integer },
equality => ['name']
}] Defensive patterns
Strategy: validation
Validate before calling
# every equality entry must be an attribute of this type or a parent
members = type.parent ? type.parent.members(true).merge(own_attrs) : own_attrs
unknown = equality_list - members.keys
raise "equality references unknown attributes: #{unknown.inspect}" unless unknown.empty? Try / catch
begin Puppet::Pops::Types::PObjectType.new(name, init_hash) rescue Puppet::ParseError => e raise unless e.message =~ /referencing non existent attribute/ raise # e.message names the missing attribute; fix spelling or declare it end
Prevention
- Keep equality lists next to the attributes block and update both together
- Prefer default equality (omit the list) unless specific members must be excluded
When it happens
Trigger: equality => ['nam'] where the declared attribute is name; referencing an attribute that was deleted or renamed in a refactor; referencing an attribute of a sibling type rather than a parent.
Common situations: Typos in equality lists; renaming attributes without updating equality; equality lists written before the attributes they assumed were added.
Related errors
- equality_include_type = false cannot be combined with non em
- %{label} equality is referencing %{attribute} which is inclu
- %{label} equality is referencing %{attribute}. Only attribut
- %{label} equality is referencing constant %{attribute}. Refe
- The attribute '%{name}' is reserved and cannot be used
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/1aa940e483204223.
Report an issue: GitHub.