{"record":{"id":"c5cefd78370568dd","repo":"puppetlabs/puppet","slug":"equality-include-type-false-cannot-be-combined-w","errorCode":null,"errorMessage":"equality_include_type = false cannot be combined with non empty equality specification","messagePattern":"equality_include_type = false cannot be combined with non empty equality specification","errorType":"exception","errorClass":"Puppet::ParseError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/p_object_type.rb","lineNumber":789,"sourceCode":"      @functions = func_specs.to_h do |key, func_spec|\n        func_spec = { KEY_TYPE => TypeAsserter.assert_instance_of(nil, TYPE_FUNCTION_TYPE, func_spec) { \"function #{label}[#{key}]\" } } unless func_spec.is_a?(Hash)\n        func = PFunction.new(key, self, func_spec)\n        name = func.name\n        raise Puppet::ParseError, _(\"%{label} conflicts with attribute with the same name\") % { label: func.label } if @attributes.include?(name)\n\n        [name, func.assert_override(parent_members)]\n      end.freeze\n    end\n\n    @equality_include_type = init_hash[KEY_EQUALITY_INCLUDE_TYPE]\n    @equality_include_type = true if @equality_include_type.nil?\n\n    equality = init_hash[KEY_EQUALITY]\n    equality = [equality] if equality.is_a?(String)\n    if equality.is_a?(Array)\n      unless equality.empty?\n        # TRANSLATORS equality_include_type = false should not be translated\n        raise Puppet::ParseError, _('equality_include_type = false cannot be combined with non empty equality specification') unless @equality_include_type\n\n        parent_eq_attrs = nil\n        equality.each do |attr_name|\n          attr = parent_members[attr_name]\n          if attr.nil?\n            attr = @attributes[attr_name] || @functions[attr_name]\n          elsif attr.is_a?(PAttribute)\n            # Assert that attribute is not already include by parent equality\n            parent_eq_attrs ||= parent_object_type.equality_attributes\n            if parent_eq_attrs.include?(attr_name)\n              including_parent = find_equality_definer_of(attr)\n              raise Puppet::ParseError, _(\"%{label} equality is referencing %{attribute} which is included in equality of %{including_parent}\") %\n                                        { label: label, attribute: attr.label, including_parent: including_parent.label }\n            end\n          end\n\n          unless attr.is_a?(PAttribute)\n            if attr.nil?","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/p_object_type.rb#L771-L807","documentation":"By default Object type equality includes a type check (equality_include_type defaults to true). Setting equality_include_type => false means two instances of different types with equal attribute values compare equal, which is only meaningful with the default equality (all non-constant attributes). Combining it with an explicit, non-empty equality list is contradictory and raises Puppet::ParseError.","triggerScenarios":"A single type declaration containing both equality_include_type => false and equality => ['id'] (or a one-element String form equality => 'id'). The check fires immediately during type resolution.","commonSituations":"Copy-pasting an equality block from a type that used default equality; tuning equality semantics without understanding that an explicit list already fixes which members participate; migrating data types between Puppet versions.","solutions":["Remove the equality_include_type => false line and keep the explicit equality list (type check stays on)","Or keep equality_include_type => false and drop the explicit equality list, accepting default equality over all non-constant attributes"],"exampleFix":"# before\ntype MyApp::Id = Object[{\n  equality_include_type => false,\n  equality => ['id']\n}]\n\n# after\ntype MyApp::Id = Object[{\n  equality => ['id']        # keep the default equality_include_type => true\n}]","handlingStrategy":"validation","validationCode":"# reject the contradictory combination up front\nif equality.is_a?(Array) && !equality.empty? && equality_include_type == false\n  raise 'equality_include_type = false cannot be combined with an explicit equality list'\nend","typeGuard":null,"tryCatchPattern":"begin\n  Puppet::Pops::Types::PObjectType.new(name, init_hash)\nrescue Puppet::ParseError => e\n  raise unless e.message =~ /equality_include_type = false/\n  raise  # drop either the flag or the explicit equality list\nend","preventionTips":["Learn the rule: an explicit equality list implies type-inclusive equality","Only set equality_include_type => false on types using default equality"],"tags":["puppet","pcore","object-type","equality","config-conflict"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}