{"record":{"id":"72d2ad690b21d1ef","repo":"apple/pkl","slug":"standard-library-class-pclass-qualifiedname-i-72d2ad","errorCode":null,"errorMessage":"Standard library class `${pClass.qualifiedName}` is not supported by Kotlin code generator. If you think this is an omission, please let us know.","messagePattern":"Standard library class `(.+?)` is not supported by Kotlin code generator\\. If you think this is an omission, please let us know\\.","errorType":"exception","errorClass":"KotlinCodeGeneratorException","httpStatus":null,"severity":"error","filePath":"pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt","lineNumber":706,"sourceCode":"          PClassInfo.Set ->\n            SET.parameterizedBy(\n              if (typeArguments.isEmpty()) ANY_NULL else typeArguments[0].toKotlinPoetName()\n            )\n          PClassInfo.Map,\n          PClassInfo.Mapping ->\n            MAP.parameterizedBy(\n              if (typeArguments.isEmpty()) ANY_NULL else typeArguments[0].toKotlinPoetName(),\n              if (typeArguments.isEmpty()) ANY_NULL else typeArguments[1].toKotlinPoetName(),\n            )\n          PClassInfo.Module -> PMODULE\n          PClassInfo.Class -> PCLASS\n          PClassInfo.Regex -> REGEX\n          PClassInfo.Version -> VERSION\n          else ->\n            when {\n              !classInfo.isStandardLibraryClass -> pClass.toKotlinPoetName()\n              else ->\n                throw KotlinCodeGeneratorException(\n                  \"Standard library class `${pClass.qualifiedName}` is not supported by Kotlin code generator. \" +\n                    \"If you think this is an omission, please let us know.\"\n                )\n            }\n        }\n      }\n      is PType.Nullable -> baseType.toKotlinPoetName().copy(nullable = true)\n      is PType.Constrained -> baseType.toKotlinPoetName()\n      is PType.Alias ->\n        when (typeAlias.qualifiedName) {\n          \"pkl.base#NonNull\" -> ANY\n          // Not currently generating Kotlin unsigned types\n          // because it's not clear if the benefits outweigh the drawbacks:\n          // - breaking change\n          // - Kotlin unsigned types aren't intended for domain modeling\n          // - diverts from Java code generator\n          // - doesn't increase safety\n          //   - range already checked on Pkl side","sourceCodeStart":688,"sourceCodeEnd":724,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt#L688-L724","documentation":"When a referenced class belongs to the Pkl standard library but has no hardcoded Kotlin mapping in toKotlinPoetName (only known ones like PClassInfo.Regex or Version are mapped), the generator throws KotlinCodeGeneratorException and invites a feature request.","triggerScenarios":"A property in a generated module is typed with an unmapped stdlib class (e.g. lesser-used pkl.base classes) while running Kotlin codegen.","commonSituations":"Using newer or niche stdlib classes that postdate the generator's PClassInfo mapping table.","solutions":["Re-type the property to a mapped stdlib class or one of your own classes.","Check which stdlib classes your pkl-codegen-kotlin version supports; upgrade the codegen tooling.","File an issue with the pkl project to add a mapping for that stdlib class."],"exampleFix":"// before (Pkl)\nprop: pkl.base.UnmappedClass\n// after\nprop: String","handlingStrategy":"validation","validationCode":"if (pClass.info.isStandardLibraryClass && pClass.info !in SUPPORTED_STD_LIB_CLASSES) {\n  throw IllegalArgumentException(\"Stdlib class ${pClass.qualifiedName} unmapped for Kotlin codegen\")\n}","typeGuard":"fun isSupportedStdlibClass(info: PClassInfo): Boolean =\n  !info.isStandardLibraryClass ||\n  info in setOf(PClassInfo.Regex, PClassInfo.Version /* ...known mappings */)","tryCatchPattern":"try {\n  generator.generate(module)\n} catch (e: KotlinCodeGeneratorException) {\n  if (e.message?.contains(\"Standard library class\") == true) {\n    logger.warn(\"Re-type or upgrade codegen for: ${e.message}\")\n  } else throw e\n}","preventionTips":["Stick to stdlib classes known to be mapped (String, Regex, Version, etc.)","Keep pkl-codegen-kotlin up to date so new PClassInfo mappings are available","Report unmapped stdlib classes upstream and re-type locally meanwhile"],"tags":["kotlin","codegen","stdlib","unsupported-class"],"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"}