{"record":{"id":"5159aeb8de8df804","repo":"puppetlabs/puppet","slug":"the-type-name-cannot-be-nil-if-title-is-given","errorCode":null,"errorMessage":"The type name cannot be nil, if title is given","messagePattern":"The type name cannot be nil, if title is given","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/type_factory.rb","lineNumber":443,"sourceCode":"    ranges.empty? ? PSemVerType::DEFAULT : PSemVerType.new(ranges)\n  end\n\n  # Produces a PResourceType with a String type_name A PResourceType with a nil\n  # or empty name is compatible with any other PResourceType.  A PResourceType\n  # with a given name is only compatible with a PResourceType with the same\n  # name.  (There is no resource-type subtyping in Puppet (yet)).\n  #\n  def self.resource(type_name = nil, title = nil)\n    case type_name\n    when PResourceType\n      PResourceType.new(type_name.type_name, title)\n    when String\n      type_name = TypeFormatter.singleton.capitalize_segments(type_name)\n      raise ArgumentError, \"Illegal type name '#{type_name}'\" unless type_name =~ Patterns::CLASSREF_EXT\n\n      PResourceType.new(type_name, title)\n    when nil\n      raise ArgumentError, 'The type name cannot be nil, if title is given' unless title.nil?\n\n      PResourceType::DEFAULT\n    else\n      raise ArgumentError, \"The type name cannot be a #{type_name.class.name}\"\n    end\n  end\n\n  # Produces PClassType with a string class_name.  A PClassType with\n  # nil or empty name is compatible with any other PClassType.  A\n  # PClassType with a given name is only compatible with a PClassType\n  # with the same name.\n  #\n  def self.host_class(class_name = nil)\n    if class_name.nil?\n      PClassType::DEFAULT\n    else\n      PClassType.new(class_name.sub(/^::/, ''))\n    end","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/type_factory.rb#L425-L461","documentation":"Error \"The type name cannot be nil, if title is given\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/types/type_factory.rb:443 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"}