{"record":{"id":"947549bbc7a2cf16","repo":"apple/pkl","slug":"unexpected-runtimedata-line-line","errorCode":null,"errorMessage":"Unexpected runtimeData line: $line","messagePattern":"Unexpected runtimeData line: \\$line","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pkl-doc/src/main/kotlin/org/pkl/doc/DocMigrator.kt","lineNumber":94,"sourceCode":"                  ) { link ->\n                    // fill in missing href\n                    if (link.href != null) link else link.copy(href = myVersionHref)\n                  }\n                runtimeData.copy(knownVersions = knownVersions)\n              }\n\n              line.startsWith(LEGACY_KNOWN_USAGES_PREFIX) -> {\n                val knownUsages = readLegacyLine(line, LEGACY_KNOWN_USAGES_PREFIX, LEGACY_SUFFIX)\n                runtimeData.copy(knownUsages = knownUsages)\n              }\n\n              line.startsWith(LEGACY_KNOWN_SUBTYPES_PREFIX) -> {\n                val knownSubtypes =\n                  readLegacyLine(line, LEGACY_KNOWN_SUBTYPES_PREFIX, LEGACY_SUFFIX)\n                runtimeData.copy(knownSubtypes = knownSubtypes)\n              }\n\n              else -> throw RuntimeException(\"Unexpected runtimeData line: $line\")\n            }\n        }\n        return runtimeData\n      } catch (e: NoSuchFileException) {\n        throw e\n      }\n    }\n\n    private fun readLegacyLine(line: String, prefix: String, suffix: String): Set<RuntimeDataLink> {\n      val jsStr = line.substring(prefix.length, line.length - suffix.length)\n      return json.decodeFromString<List<RuntimeDataLink>>(jsStr).toSet()\n    }\n  }\n\n  val isUpToDate by lazy {\n    if (!Files.exists(outputDir.resolve(\"index.html\"))) {\n      // must be the first run\n      return@lazy true","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-doc/src/main/kotlin/org/pkl/doc/DocMigrator.kt#L76-L112","documentation":"DocMigrator.parseLegacyRuntimeData reads each line of a legacy runtime-data file and matches it against known prefixes (e.g. LEGACY_KNOWN_SUBTYPES_PREFIX). A line that matches no known prefix means the legacy file is corrupt, truncated, or from an unrecognized format, so parsing fails with this RuntimeException.","triggerScenarios":"Calling DocMigrator (which parses legacy runtime data) on a runtime-data file containing a line that is not blank and does not start with any recognized legacy prefix.","commonSituations":"Hand-edited or corrupted runtime-data file; docsite produced by a much older or newer pkl-doc whose line format differs; partial file write leaving malformed lines.","solutions":["Restore the runtime-data file from version control or regenerate the docsite","Compare the offending line against the expected legacy line prefixes","Delete the legacy file(s) and regenerate documentation from source"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { docMigrator.migrate() } catch (e: RuntimeException) { if (e.message?.startsWith(\"Unexpected runtimeData line\") == true) { restoreOrRegenerateRuntimeData() } else throw e }","preventionTips":["Never hand-edit legacy runtime-data files","Keep the docsite output in version control so corrupt files can be restored","Regenerate the docsite rather than migrating from damaged inputs"],"tags":["parsing","legacy-format","corrupt-data"],"backgroundTag":"unexpected-api-response-shape","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"}