{"record":{"id":"a8898c39f2510739","repo":"apple/pkl","slug":"internalstdlibclass","errorCode":"internalStdLibClass","errorMessage":"internalStdLibClass (VarArgs)","messagePattern":"internalStdLibClass \\(VarArgs\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java","lineNumber":2406,"sourceCode":"\n  public static class VarArgsTypeNode extends ObjectSlotTypeNode {\n    @Child private TypeNode elementTypeNode;\n\n    public VarArgsTypeNode(SourceSection sourceSection, TypeNode elementTypeNode) {\n\n      super(sourceSection);\n      this.elementTypeNode = elementTypeNode;\n    }\n\n    @Override\n    public @Nullable Object createDefaultValue(\n        VirtualFrame frame,\n        VmLanguage language,\n        SourceSection headerSection,\n        String qualifiedName) {\n\n      CompilerDirectives.transferToInterpreter();\n      throw exceptionBuilder()\n          .evalError(\"internalStdLibClass\", \"VarArgs\")\n          .withSourceSection(headerSection)\n          .build();\n    }\n\n    @Override\n    protected final PType doExport() {\n      return new PType.Class(BaseModule.getVarArgsClass().export(), elementTypeNode.doExport());\n    }\n\n    @Override\n    protected Object executeLazily(VirtualFrame frame, Object value) {\n      CompilerDirectives.transferToInterpreter();\n      throw exceptionBuilder().evalError(\"internalStdLibClass\", \"VarArgs\").build();\n    }\n\n    @Override\n    public boolean doIsEquivalentTo(TypeNode other) {","sourceCodeStart":2388,"sourceCodeEnd":2424,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java#L2388-L2424","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nf: (varargs) -> Any = ...\nprop: VarArgs = ...\n\n// after\nprop: List<Any> = List(1, 2, 3)","handlingStrategy":"validation","validationCode":"// reject varargs in user-facing type positions before evaluation\nif (typeName == \"varargs\") throw \"varargs is only valid in function parameter lists\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["pkl","internal-class","varargs","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}