{"record":{"id":"7b4f1a82f62e0003","repo":"apple/pkl","slug":"notaparameterizableclass","errorCode":"notAParameterizableClass","errorMessage":"notAParameterizableClass","messagePattern":"notAParameterizableClass","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java","lineNumber":316,"sourceCode":"          return FunctionNClassTypeNodeGen.create(sourceSection, resolvedTypeArgumentNodes);\n        }\n\n        if (clazz.isClassClass()) {\n          return ClassClassTypeNodeGen.create(sourceSection, typeArgumentNodes[0].execute(frame));\n        }\n\n        if (clazz.isVarArgsClass()) {\n          return new VarArgsTypeNode(sourceSection, typeArgumentNodes[0].execute(frame));\n        }\n\n        if (clazz.isReferenceClass()) {\n          return ReferenceTypeNodeGen.create(\n              sourceSection,\n              typeArgumentNodes[0].execute(frame),\n              typeArgumentNodes[1].execute(frame));\n        }\n\n        throw exceptionBuilder()\n            .evalError(\"notAParameterizableClass\", clazz.getDisplayName())\n            .withSourceSection(typeArgumentNodes[0].sourceSection)\n            .build();\n      }\n\n      if (baseType instanceof VmTypeAlias typeAlias) {\n        var argLength = typeArgumentNodes.length;\n        var resolvedTypeArgumentNodes = new TypeNode[argLength];\n        for (var i = 0; i < argLength; i++) {\n          resolvedTypeArgumentNodes[i] = typeArgumentNodes[i].execute(frame);\n        }\n        return new TypeAliasTypeNode(sourceSection, typeAlias, resolvedTypeArgumentNodes);\n      }\n\n      var module = (VmTyped) baseType;\n      throw exceptionBuilder()\n          .evalError(\"notAParameterizableClass\", module.getModuleInfo().getModuleName())\n          .withSourceSection(typeArgumentNodes[0].sourceSection)","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java#L298-L334","documentation":"Raised by the parameterized-type resolution path in `UnresolvedTypeNode.Parameterized#execute`: type arguments were supplied to a base type that is a class but is not parameterizable (it has no type parameters). The error `notAParameterizableClass` carries the class's display name and points at the first type argument's source section.","triggerScenarios":"Writing `Foo<X>` or a mapping-like use `Foo<K, V>` where `Foo` is a plain class with no type parameters, e.g. `names: String<Int> = ...` or applying `<...>` to any non-generic class.","commonSituations":"Copy-pasting generic syntax (e.g. from Java-like habits) onto Pkl's non-generic classes; misspelling a generic class name so it resolves to a non-generic one; wrapping Mapping/List types incorrectly around an argument instead of using the right container class.","solutions":["Remove the `<...>` type arguments from the non-parameterizable class.","If you need a parameterized container, use Pkl's generic classes: `List<T>`, `Set<T>`, `Map<K,V>`, `Mapping<K,V>`, `FunctionN<...>`, `Class<T>`.","Verify the class name spelling; you may have meant a different, generic class.","Check the class's definition (typeParameterCount) to confirm whether it takes type arguments."],"exampleFix":"// before\nmapping: MyRepo<String> = ...   // MyRepo takes no type args\n// after\nmapping: Mapping<String, MyRepo> = ...","handlingStrategy":"validation","validationCode":"function assertNoTypeArgs(name, args) {\n  if (args && args.length) throw new Error(`${name} is not parameterizable; remove <...> arguments`);\n}","typeGuard":"function isParameterizable(cls) { return cls && typeof cls.typeParameterCount === \"number\" && cls.typeParameterCount > 0; }","tryCatchPattern":"try {\n  applyTypeArgs(cls, args);\n} catch (e) {\n  // fall back to non-generic usage\n}","preventionTips":["Only apply `<...>` to generic classes (List, Set, Map, Mapping, FunctionN, Class).","Verify class names before adding type arguments.","Consult the class definition to check its type-parameter list."],"tags":["pkl","generics","type-annotation","type-arguments"],"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-14T11:17:12.474Z"}