{"record":{"id":"fa8bee4994458710","repo":"apple/pkl","slug":"cannotfindqualifiedtype","errorCode":"cannotFindQualifiedType","errorMessage":"cannotFindQualifiedType","messagePattern":"cannotFindQualifiedType","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/type/ResolveQualifiedDeclaredTypeNode.java","lineNumber":64,"sourceCode":"    assert moduleName.isLocalProp();\n    assert typeName.isRegular();\n  }\n\n  @Override\n  public Object executeGeneric(VirtualFrame frame) {\n    CompilerDirectives.transferToInterpreter();\n\n    var enclosingModule = (VmTyped) getModuleNode.executeGeneric(frame);\n    var importedModule = getImport(enclosingModule, moduleName, moduleNameSection);\n\n    // search module hierarchy\n    // (type declared in base module is accessible through extending and amending modules)\n    for (var currModule = importedModule; currModule != null; currModule = currModule.getParent()) {\n      var result = getType(currModule, typeName, sourceSection);\n      if (result != null) return result;\n    }\n\n    throw exceptionBuilder()\n        .evalError(\n            \"cannotFindQualifiedType\", typeName, importedModule.getModuleInfo().getModuleName())\n        .withSourceSection(typeNameSection)\n        .build();\n  }\n}\n","sourceCodeStart":46,"sourceCodeEnd":71,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/type/ResolveQualifiedDeclaredTypeNode.java#L46-L71","documentation":"`cannotFindQualifiedType` is thrown by ResolveQualifiedDeclaredTypeNode.executeGeneric when a qualified type `module.TypeName` cannot be resolved: neither the imported module nor any of its parent (extending/amending) modules declare the type name. The message names the type and the module that was searched.","triggerScenarios":"`importedMod.MissingType` in a type position where MissingType does not exist in the imported module or its module hierarchy; typo in the type name; the type was removed/renamed upstream.","commonSituations":"Using a base-module class via a custom module that re-exports only some types; upgrading a dependency where a class was renamed; referring to a type from the wrong imported module.","solutions":["Fix the type name spelling or use the type's current name","Import the module that actually declares the type","Check the named module for the type's new location after upgrades"],"exampleFix":"// before\nimport \"base.pkl\" as base\nx: base.Clsss\n// after\nx: base.Class","handlingStrategy":"validation","validationCode":"// validate type exists before evaluating\nif (!importedModuleExports.includes(\"TypeName\")) throw new Error(\"type not found in imported module\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Re-check type names after dependency upgrades","Import the module that declares the type directly"],"tags":["pkl","type-resolution","import"],"backgroundTag":"resource-not-found","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}