{"record":{"id":"2bac8de4d927d73b","repo":"puppetlabs/puppet","slug":"reference-to-unresolved-type-name","errorCode":null,"errorMessage":"reference to unresolved type '%{name}'","messagePattern":"reference to unresolved type '%(.+?)'","errorType":"exception","errorClass":"Puppet::ParseError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/p_object_type.rb","lineNumber":705,"sourceCode":"  def _pcore_init_from_hash(init_hash)\n    TypeAsserter.assert_instance_of('object initializer', TYPE_OBJECT_I12N, init_hash)\n    @type_parameters = EMPTY_HASH\n    @attributes = EMPTY_HASH\n    @functions = EMPTY_HASH\n\n    # Name given to the loader have higher precedence than a name declared in the type\n    @name ||= init_hash[KEY_NAME]\n    @name.freeze unless @name.nil?\n\n    @parent = init_hash[KEY_PARENT]\n\n    parent_members = EMPTY_HASH\n    parent_type_params = EMPTY_HASH\n    parent_object_type = nil\n    unless @parent.nil?\n      check_self_recursion(self)\n      rp = resolved_parent\n      raise Puppet::ParseError, _(\"reference to unresolved type '%{name}'\") % { :name => rp.type_string } if rp.is_a?(PTypeReferenceType)\n\n      if rp.is_a?(PObjectType)\n        parent_object_type = rp\n        parent_members = rp.members(true)\n        parent_type_params = rp.type_parameters(true)\n      end\n    end\n\n    type_parameters = init_hash[KEY_TYPE_PARAMETERS]\n    unless type_parameters.nil? || type_parameters.empty?\n      @type_parameters = {}\n      type_parameters.each do |key, param_spec|\n        param_value = :undef\n        if param_spec.is_a?(Hash)\n          param_type = param_spec[KEY_TYPE]\n          param_value = param_spec[KEY_VALUE] if param_spec.include?(KEY_VALUE)\n        else\n          param_type = TypeAsserter.assert_instance_of(nil, PTypeType::DEFAULT, param_spec) { \"type_parameter #{label}[#{key}]\" }","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/p_object_type.rb#L687-L723","documentation":"While resolving an Object type, Puppet resolves the declared parent through the loader. If the loader can only produce a PTypeReferenceType - an unresolved reference to a type name - the parent cannot be used, and Puppet::ParseError 'reference to unresolved type' is raised with the unresolved type string.","triggerScenarios":"A type declaration like type MyApp::Child = Object[{ parent => 'Does::NotExist', ... }], or a parent type defined in a module that is not installed, not declared as a dependency, or not yet loaded at resolution time. Name-authority mismatches (fully qualified name resolving to a different authority) also produce an unresolved reference.","commonSituations":"Typo or wrong capitalization in the parent name; parent type lives in another module missing from metadata.json dependencies; module extracted to a different name; Puppet 4 type alias referencing a type from an unavailable environment.","solutions":["Verify the parent type name spelling and capitalization exactly matches its definition","Ensure the module defining the parent is present on the modulepath and listed in metadata.json dependencies","If the parent is a Puppet 3.x or core type, use the correct core name; only Object types may be parents","Check that both types share a loadable name authority (same module namespace or explicit name_authority)"],"exampleFix":"# before\ntype MyApp::Child = Object[{\n  parent => 'MyApp::Parrent',   # typo, cannot be resolved\n  attributes => { extra => String }\n}]\n\n# after\ntype MyApp::Child = Object[{\n  parent => 'MyApp::Parent',\n  attributes => { extra => String }\n}]","handlingStrategy":"validation","validationCode":"# resolve the parent name through the same loader before defining the child\nresolved = Puppet::Pops::Types::TypeParser.singleton.parse('MyApp::Parent', loader)\nif resolved.is_a?(Puppet::Pops::Types::PTypeReferenceType)\n  raise \"parent type cannot be resolved: #{resolved.type_string} - check module dependencies\"\nend","typeGuard":"def resolvable_parent?(name, loader)\n  t = Puppet::Pops::Types::TypeParser.singleton.parse(name, loader)\n  !t.is_a?(Puppet::Pops::Types::PTypeReferenceType)\nend","tryCatchPattern":"begin\n  Puppet::Pops::Types::PObjectType.new(name, init_hash)\nrescue Puppet::ParseError => e\n  raise unless e.message =~ /reference to unresolved type/\n  # e.message contains the unresolved type string; verify module presence and spelling\n  raise\nend","preventionTips":["Declare the module that defines the parent in metadata.json dependencies","Use fully qualified, correctly capitalized parent names","Validate parent resolvability in type-definition unit tests loaded through the real loader"],"tags":["puppet","pcore","object-type","inheritance","type-resolution"],"backgroundTag":"unresolved-type-reference","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}