{"record":{"id":"83781ff73e331a73","repo":"apple/pkl","slug":"notatype","errorCode":"notAType","errorMessage":"notAType","messagePattern":"notAType","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/type/ResolveDeclaredTypeNode.java","lineNumber":66,"sourceCode":"    assert importName.isLocalProp();\n\n    var member = module.getMember(importName);\n    if (member == null) {\n      throw exceptionBuilder()\n          .evalError(\"cannotFindModuleImport\", importName)\n          .withSourceSection(importNameSection)\n          .build();\n    }\n\n    if (!member.isImport()) {\n      throw exceptionBuilder()\n          .evalError(\"notAModuleImport\", importName)\n          .withSourceSection(importNameSection)\n          .build();\n    }\n\n    if (member.isGlob()) {\n      throw exceptionBuilder()\n          .evalError(\"notAType\", importName)\n          .withSourceSection(importNameSection)\n          .build();\n    }\n\n    assert member.getConstantValue() == null;\n    var result = module.getCachedValue(importName);\n    if (result == null) {\n      result = callNode.call(member.getCallTarget(), module, module, importName);\n      module.setCachedValue(importName, result);\n    }\n    return (VmTyped) result;\n  }\n\n  protected @Nullable Object getType(\n      VmTyped module, Identifier typeName, SourceSection typeNameSection) {\n    var member = module.getMember(typeName);\n    if (member == null) return null;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/type/ResolveDeclaredTypeNode.java#L48-L84","documentation":"`notAType` is thrown by ResolveDeclaredTypeNode.getImport when the import in a qualified type exists and is an import, but the referenced member inside it is a glob (star import) rather than a concrete type. Type annotations must name actual types, not glob-imported bindings.","triggerScenarios":"Using `starImport.TypeName` where the member matched through a glob (`import \"*\" as starImport`) is not a type/class, e.g. it's a glob binding that can't be used as a declared type.","commonSituations":"Using glob imports in modules with qualified type annotations; expecting a glob import member to be a class when it is a value or module-level binding.","solutions":["Import the specific module containing the type directly instead of using a glob import","Reference the type via the module that actually declares it as a class/typealias","Replace the glob import with an explicit named import"],"exampleFix":"// before\nimport \"*\" as lib\nx: lib.Config\n// after\nimport \"config.pkl\" as cfg\nx: cfg.Config","handlingStrategy":"validation","validationCode":"// avoid glob imports when using qualified types\nif (/^import\\s+\"\\*\"/m.test(source)) console.warn(\"glob import used with qualified type\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer explicit named imports over glob imports","Reference types via modules that declare them as classes"],"tags":["pkl","import","type-resolution","glob-import"],"backgroundTag":"invalid-argument-value","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"}