apple/pkl · error
internalStdLibClass
internalStdLibClass
Error message
internalStdLibClass (VarArgs)
What it means
The VarArgs class is an internal stdlib class that cannot be evaluated as a value type at runtime. This node throws an evalError("internalStdLibClass", "VarArgs") attached to the type's header section when execution reaches it.
Solutions
- Use `varargs` only in function parameter positions where the language permits it.
- Replace any VarArgs-typed annotation with a concrete type like `List<T>` or `Array`.
- If you need variadic behavior in user code, accept `List`/`Array` parameters instead.
- Avoid importing or re-exporting internal stdlib classes.
Example fix
// before f: (varargs) -> Any = ... prop: VarArgs = ... // after prop: List<Any> = List(1, 2, 3)
Defensive patterns
Strategy: validation
Validate before calling
// reject varargs in user-facing type positions before evaluation if (typeName == "varargs") throw "varargs is only valid in function parameter lists"
Prevention
- Never annotate properties or type aliases with varargs.
- Use List/Array for variadic data in user code.
- Don't re-export internal stdlib classes from libraries.
When it happens
Trigger: User code references the internal `varargs` type in a position where it must be evaluated (e.g. as a value annotation or in a context requiring a concrete class), rather than only as a variadic parameter declaration inside a method/function signature.
Common situations: Copying stdlib function signatures and accidentally exposing `varargs` in a public annotation; writing a type alias or property type that names VarArgs; tooling generating signatures from stdlib metadata.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Failed to parse Pkl module file path
- abstractMemberCannotHaveBody
- abstractMethodInNonAbstractType
- array
- Cannot convert pkl.base#Int
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/a8898c39f2510739.
Report an issue: GitHub.
Appendix: source
Thrown at pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java:2406
public static class VarArgsTypeNode extends ObjectSlotTypeNode {
@Child private TypeNode elementTypeNode;
public VarArgsTypeNode(SourceSection sourceSection, TypeNode elementTypeNode) {
super(sourceSection);
this.elementTypeNode = elementTypeNode;
}
@Override
public @Nullable Object createDefaultValue(
VirtualFrame frame,
VmLanguage language,
SourceSection headerSection,
String qualifiedName) {
CompilerDirectives.transferToInterpreter();
throw exceptionBuilder()
.evalError("internalStdLibClass", "VarArgs")
.withSourceSection(headerSection)
.build();
}
@Override
protected final PType doExport() {
return new PType.Class(BaseModule.getVarArgsClass().export(), elementTypeNode.doExport());
}
@Override
protected Object executeLazily(VirtualFrame frame, Object value) {
CompilerDirectives.transferToInterpreter();
throw exceptionBuilder().evalError("internalStdLibClass", "VarArgs").build();
}
@Override
public boolean doIsEquivalentTo(TypeNode other) {View on GitHub (pinned to f3efcbfc9b)