{"record":{"id":"e494d8c34abfa67a","repo":"puppetlabs/puppet","slug":"reference-to-unresolved-type-name-e494d8","errorCode":null,"errorMessage":"Reference to unresolved type #{@name}","messagePattern":"Reference to unresolved type #(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/types.rb","lineNumber":3406,"sourceCode":"    @self_recursion = false\n  end\n\n  def assignable?(o, guard = nil)\n    if @self_recursion\n      guard ||= RecursionGuard.new\n      guard.with_this(self) { |state| state == RecursionGuard::SELF_RECURSION_IN_BOTH ? true : super(o, guard) }\n    else\n      super(o, guard)\n    end\n  end\n\n  # Returns the resolved type. The type must have been resolved by a call prior to calls to this\n  # method or an error will be raised.\n  #\n  # @return [PAnyType] The resolved type of this alias.\n  # @raise [Puppet::Error] unless the type has been resolved prior to calling this method\n  def resolved_type\n    raise Puppet::Error, \"Reference to unresolved type #{@name}\" unless @resolved_type\n\n    @resolved_type\n  end\n\n  def callable_args?(callable, guard)\n    guarded_recursion(guard, false) { |g| resolved_type.callable_args?(callable, g) }\n  end\n\n  def check_self_recursion(originator)\n    resolved_type.check_self_recursion(originator) unless originator.equal?(self)\n  end\n\n  def kind_of_callable?(optional = true, guard = nil)\n    guarded_recursion(guard, false) { |g| resolved_type.kind_of_callable?(optional, g) }\n  end\n\n  def instance?(o, guard = nil)\n    really_instance?(o, guard) == 1","sourceCodeStart":3388,"sourceCodeEnd":3424,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/types.rb#L3388-L3424","documentation":"A type alias object (PTypeAliasType) is only a name plus an expression until resolve(loader) interprets that expression against a loader. resolved_type returns the interpretation and raises Puppet::Error if resolution has not run yet. Normal manifest code never sees this because TypeParser resolves aliases during parsing; hitting it means the pops API was driven out of order from Ruby, or resolution failed earlier (for example the defining module failed to load).","triggerScenarios":"Ruby code holding a PTypeAliasType calls .resolved_type before calling .resolve(loader); an alias is inspected by tooling while the defining TypeSet or module is still loading; an earlier failure (autoload error, missing module) prevented resolve from running.","commonSituations":"Gems and custom functions that walk the type system manually; type-inspection/debug or documentation tooling; Puppet version changes that reorder alias resolution (a known source of regressions).","solutions":["Call resolve(loader) on the alias before reading resolved_type.","Make sure the module/TypeSet defining the alias is fully loaded and the name is resolvable from the loader you pass.","Upgrade Puppet - ordering bugs around alias resolution have been fixed over time; a minimal reproducible case should be reported upstream.","In tooling, wrap access in begin/rescue Puppet::Error, resolve, then read again."],"exampleFix":"# before (Ruby)\nreal = alias_t.resolved_type   # Puppet::Error: Reference to unresolved type\n\n# after\nbegin\n  real = alias_t.resolved_type\nrescue Puppet::Error\n  alias_t.resolve(loader)\n  real = alias_t.resolved_type\nend","handlingStrategy":"try-catch","validationCode":"# ensure resolution before access (resolve is a no-op once resolved)\nalias_t.resolve(loader) if alias_t.instance_variable_get(:@resolved_type).nil?\nreal = alias_t.resolved_type","typeGuard":null,"tryCatchPattern":"begin\n  real = alias_t.resolved_type\nrescue Puppet::Error\n  alias_t.resolve(loader)   # resolution had not run; do it, then read again\n  real = alias_t.resolved_type\nend","preventionTips":["Always resolve aliases through TypeParser / resolve(loader) before inspecting them from Ruby.","Run type-inspection tooling inside a loader context so resolution can happen.","If 'unresolved type' appears in pure manifest code, verify the defining module loads, then report upstream."],"tags":["puppet","type-system","type-alias","lazy-initialization","ruby-api"],"backgroundTag":"unresolved-type-alias","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}