apple/pkl · error
notAType
notAType
Error message
notAType
What it means
`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.
Source
Thrown at pkl-core/src/main/java/org/pkl/core/ast/type/ResolveDeclaredTypeNode.java:66
assert importName.isLocalProp();
var member = module.getMember(importName);
if (member == null) {
throw exceptionBuilder()
.evalError("cannotFindModuleImport", importName)
.withSourceSection(importNameSection)
.build();
}
if (!member.isImport()) {
throw exceptionBuilder()
.evalError("notAModuleImport", importName)
.withSourceSection(importNameSection)
.build();
}
if (member.isGlob()) {
throw exceptionBuilder()
.evalError("notAType", importName)
.withSourceSection(importNameSection)
.build();
}
assert member.getConstantValue() == null;
var result = module.getCachedValue(importName);
if (result == null) {
result = callNode.call(member.getCallTarget(), module, module, importName);
module.setCachedValue(importName, result);
}
return (VmTyped) result;
}
protected @Nullable Object getType(
VmTyped module, Identifier typeName, SourceSection typeNameSection) {
var member = module.getMember(typeName);
if (member == null) return null;View on GitHub (pinned to f3efcbfc9b)
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
Example fix
// before import "*" as lib x: lib.Config // after import "config.pkl" as cfg x: cfg.Config
Defensive patterns
Strategy: validation
Validate before calling
// avoid glob imports when using qualified types
if (/^import\s+"\*"/m.test(source)) console.warn("glob import used with qualified type"); Prevention
- Prefer explicit named imports over glob imports
- Reference types via modules that declare them as classes
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- cannotFindModuleImport
- notAModuleImport
- cannotFindQualifiedType
- cannotResolveInLocalDependencyNotGlobbable
- cannotFindStdLibModule
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/83781ff73e331a73.
Report an issue: GitHub.