{"record":{"id":"b345c7c3ba0baff3","repo":"apple/pkl","slug":"standard-library-typealias-qualifiedname-is-n","errorCode":null,"errorMessage":"Standard library typealias `${qualifiedName}` is not supported by Kotlin code generator. If you think this is an omission, please let us know.","messagePattern":"Standard library typealias `(.+?)` 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":633,"sourceCode":"    val (packageName, moduleTypeName) = nameMapper.map(moduleName)\n    return if (isModuleClass) {\n      ClassName(packageName, moduleTypeName)\n    } else {\n      ClassName(packageName, moduleTypeName, simpleName)\n    }\n  }\n\n  private fun TypeAlias.toKotlinPoetName(): ClassName {\n    val (packageName, moduleTypeName) = nameMapper.map(moduleName)\n\n    return when {\n      aliasedType is PType.Alias -> {\n        // Kotlin type generated for [this] is a top-level type alias\n        ClassName(packageName, simpleName)\n      }\n      CodeGeneratorUtils.isRepresentableAsEnum(aliasedType, null) -> {\n        if (isStandardLibraryMember) {\n          throw KotlinCodeGeneratorException(\n            \"Standard library typealias `${qualifiedName}` is not supported by Kotlin code generator.\" +\n              \" If you think this is an omission, please let us know.\"\n          )\n        }\n        // Kotlin type generated for [this] is a nested enum class\n        ClassName(packageName, moduleTypeName, simpleName)\n      }\n      else -> {\n        // Kotlin type generated for [this] is a top-level type alias\n        ClassName(packageName, simpleName)\n      }\n    }\n  }\n\n  private fun PType.toKotlinPoetName(): TypeName =\n    when (this) {\n      PType.UNKNOWN -> ANY_NULL\n      PType.NOTHING -> NOTHING","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt#L615-L651","documentation":"toKotlinPoetName cannot emit a type reference for a standard library typealias whose aliased type is enum-representable, because stdlib members are not code-generated into the user's output. It throws KotlinCodeGeneratorException asking users to report the omission.","triggerScenarios":"A user module references a stdlib typealias (isStandardLibraryMember == true) that resolves to an enum-representable aliased type while generating Kotlin code.","commonSituations":"Properties typed with stdlib type aliases (e.g. hash-algorithm-like literal unions in pkl:base) appearing in modules run through `pkl codegen kotlin`.","solutions":["Replace the stdlib typealias usage in your module with your own string-literal typealias or explicit type.","Type the property as String if any of the alias values are acceptable.","File an issue with the pkl project asking for support of that specific stdlib typealias."],"exampleFix":"// before (Pkl)\nprop: pkl.base.SomeStdlibAlias\n// after\ntypealias MyAlias = \"a\" | \"b\"\nprop: MyAlias","handlingStrategy":"validation","validationCode":"if (typeAlias.isStandardLibraryMember && CodeGeneratorUtils.isRepresentableAsEnum(typeAlias.aliasedType, null)) {\n  throw IllegalArgumentException(\"Stdlib typealias ${typeAlias.qualifiedName} not supported by Kotlin codegen\")\n}","typeGuard":"fun isStdlibEnumAlias(t: PType.Alias): Boolean =\n  t.isStandardLibraryMember && CodeGeneratorUtils.isRepresentableAsEnum(t.aliasedType, null)","tryCatchPattern":"try {\n  generator.generate(module)\n} catch (e: KotlinCodeGeneratorException) {\n  if (e.message?.contains(\"Standard library typealias\") == true) {\n    logger.warn(\"Re-type property locally: ${e.message}\")\n  } else throw e\n}","preventionTips":["Define your own string-literal typealiases instead of relying on stdlib enum-like aliases","Check stdlib usage in modules slated for Kotlin codegen","Track pkl-codegen-kotlin release notes for newly supported stdlib typealiases"],"tags":["kotlin","codegen","stdlib","typealias"],"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"}