{"record":{"id":"a161fd809fb9cd5e","repo":"puppetlabs/puppet","slug":"label-of-kind-kind-cannot-be-combined-with","errorCode":null,"errorMessage":"%{label} of kind '%{kind}' cannot be combined with an attribute value","messagePattern":"%(.+?) of kind '%(.+?)' cannot be combined with an attribute value","errorType":"exception","errorClass":"Puppet::ParseError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/p_object_type.rb","lineNumber":314,"sourceCode":"    def initialize(name, container, init_hash)\n      super(name, container, TypeAsserter.assert_instance_of(nil, TYPE_ATTRIBUTE, init_hash) { \"initializer for #{self.class.label(container, name)}\" })\n      if name == Serialization::PCORE_TYPE_KEY || name == Serialization::PCORE_VALUE_KEY\n        raise Puppet::ParseError, _(\"The attribute '%{name}' is reserved and cannot be used\") % { name: name }\n      end\n\n      @kind = init_hash[KEY_KIND]\n      if @kind == ATTRIBUTE_KIND_CONSTANT # final is implied\n        if init_hash.include?(KEY_FINAL) && !@final\n          # TRANSLATOR 'final => false' is puppet syntax and should not be translated\n          raise Puppet::ParseError, _(\"%{label} of kind 'constant' cannot be combined with final => false\") % { label: label }\n        end\n\n        @final = true\n      end\n\n      if init_hash.include?(KEY_VALUE)\n        if @kind == ATTRIBUTE_KIND_DERIVED || @kind == ATTRIBUTE_KIND_GIVEN_OR_DERIVED\n          raise Puppet::ParseError, _(\"%{label} of kind '%{kind}' cannot be combined with an attribute value\") % { label: label, kind: @kind }\n        end\n\n        v = init_hash[KEY_VALUE]\n        @value = v == :default ? v : TypeAsserter.assert_instance_of(nil, type, v) { \"#{label} #{KEY_VALUE}\" }\n      else\n        raise Puppet::ParseError, _(\"%{label} of kind 'constant' requires a value\") % { label: label } if @kind == ATTRIBUTE_KIND_CONSTANT\n\n        @value = :undef # Not to be confused with nil or :default\n      end\n    end\n\n    def callable_type\n      TYPE_ATTRIBUTE_CALLABLE\n    end\n\n    # @api public\n    def eql?(o)\n      super && @kind == o.kind && @value == (o.value? ? o.value : :undef)","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/p_object_type.rb#L296-L332","documentation":"Attributes of kind 'derived' or 'given_or_derived' compute their value when an instance is created, so they cannot declare a static 'value'. PAttribute#initialize raises this Puppet::ParseError when the init hash contains both a computed kind and a 'value' key.","triggerScenarios":"An attribute hash like {'type' => Integer, 'kind' => 'derived', 'value' => 3}; equally for kind 'given_or_derived' with any 'value' entry.","commonSituations":"Converting a regular attribute (with a default value) to a derived one and leaving the default in place; template code that attaches default values to every attribute regardless of kind.","solutions":["Remove the 'value' key from derived/given_or_derived attributes.","If a fixed value is actually wanted, use kind 'constant' (with a value) or a plain attribute with a default.","Re-read the kind semantics: 'given' accepts constructor input, 'derived' computes, only plain/constant attributes may carry defaults."],"exampleFix":"# before\n{'type' => Integer, 'kind' => 'derived', 'value' => 3}\n\n# after\n{'type' => Integer, 'kind' => 'derived'}","handlingStrategy":"validation","validationCode":"# Ruby — reject value on computed kinds before declaration\nif %w[derived given_or_derived].include?(h['kind']) && h.key?('value')\n  fail(\"kind #{h['kind']} cannot declare a value\")\nend","typeGuard":"def value_allowed_for_kind?(kind)\n  kind != 'derived' && kind != 'given_or_derived'\nend","tryCatchPattern":null,"preventionTips":["When converting an attribute to derived/given_or_derived, delete its 'value' key in the same change.","Only plain and constant attributes may carry defaults."],"tags":["puppet","object-type","attribute-declaration","derived-attribute","type-declaration"],"backgroundTag":"conflicting-declaration-options","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}