{"record":{"id":"9364076a427763ab","repo":"puppetlabs/puppet","slug":"you-must-specify-title-patterns-when-there-are-two","errorCode":null,"errorMessage":"you must specify title patterns when there are two or more key attributes","messagePattern":"you must specify title patterns when there are two or more key attributes","errorType":"exception","errorClass":"Puppet::DevError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/resource/resource_type_impl.rb","lineNumber":167,"sourceCode":"        # Here it is silently ignored.\n        nil\n      when 1\n        if @title_patterns_hash.nil?\n          [[/(.*)/m, [[@key_attributes.first]]]]\n        else\n          # TechDebt: The case of having one namevar and an empty title patterns is unspecified behavior in puppet.\n          # Here, it may lead to an empty map which may or may not trigger the wanted/expected behavior.\n          #\n          @title_patterns_hash.map { |k, v| [k, v.map { |n| [n.to_sym] }] }\n        end\n      else\n        if @title_patterns_hash.nil? || @title_patterns_hash.empty?\n          # TechDebt: While title patterns must be specified when more than one is used, they do not have\n          # to match/set them all since some namevars can be omitted (to support the use case in\n          # the 'package' type where 'provider' attribute is handled as part of the key without being\n          # set from the title.\n          #\n          raise Puppet::DevError, _(\"you must specify title patterns when there are two or more key attributes\")\n        end\n\n        @title_patterns_hash.nil? ? [] : @title_patterns_hash.map { |k, v| [k, v.map { |n| [n.to_sym] }] }\n      end\n  end\n\n  # Override CompilableResource inclusion\n  def is_3x_ruby_plugin?\n    false\n  end\n\n  # Answers if the parameter name is a parameter/attribute of this type\n  # This is part of the Puppet::Type API\n  # Check if used when compiling (it is triggered in an apply)\n  #\n  def valid_parameter?(name)\n    @attributes.include?(name) || METAPARAMSET.include?(name)\n  end","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/resource/resource_type_impl.rb#L149-L185","documentation":"Error \"you must specify title patterns when there are two or more key attributes\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/resource/resource_type_impl.rb:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}