{"record":{"id":"7fae1d174881e677","repo":"apple/pkl","slug":"cannotrendertype","errorCode":"cannotRenderType","errorMessage":"cannotRenderType","messagePattern":"cannotRenderType","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/stdlib/base/PListRendererNodes.java","lineNumber":110,"sourceCode":"      } else {\n        builder.append(value);\n      }\n\n      builder.append(\"</real>\");\n    }\n\n    @Override\n    public void visitBoolean(Boolean value) {\n      if (value) {\n        builder.append(\"<true/>\");\n      } else {\n        builder.append(\"<false/>\");\n      }\n    }\n\n    @Override\n    public void visitDuration(VmDuration value) {\n      throw new VmExceptionBuilder()\n          .evalError(\"cannotRenderType\", \"Duration\", \"XML property list\")\n          .withProgramValue(\"Value\", value)\n          .build();\n    }\n\n    @Override\n    public void visitDataSize(VmDataSize value) {\n      throw new VmExceptionBuilder()\n          .evalError(\"cannotRenderType\", \"DataSize\", \"XML property list\")\n          .withProgramValue(\"Value\", value)\n          .build();\n    }\n\n    @Override\n    public void visitBytes(VmBytes value) {\n      builder.append(\"<data>\");\n      builder.append(value.base64());\n      builder.append(\"</data>\");","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/stdlib/base/PListRendererNodes.java#L92-L128","documentation":"The XML property list (PList) renderer cannot encode Pkl Duration values — the plist format has no duration type. visitDuration throws cannotRenderType naming the type `Duration` and target format `XML property list`, with the value attached for debugging. Use plist-supported types (String, Int, Double, Boolean, Data, Date) instead.","triggerScenarios":"Rendering output with a PListRenderer (xml plist) when the rendered value graph contains a VmDuration, e.g. `timeout = 5.min` reached from output.value.","commonSituations":"Config values that changed from numeric seconds to Duration during a refactor; passing through library-defined settings objects that include durations; generating Apple plist config files from Pkl settings containing timeouts/intervals.","solutions":["Convert the Duration to a plist-safe representation before rendering, e.g. `value.value` (seconds as Double) or `value.toUnit(Unit.s)`.","Store the duration as a String (`\"5.min\"`) or plain number of seconds in the rendered object.","Restructure output so Duration fields live outside the plist-rendered portion.","Choose a different output renderer (YAML/JSON) if plist is not required."],"exampleFix":"// before\noutput { renderer = new PListRenderer {}; value { timeout = 30.s } }\n\n// after\noutput { renderer = new PListRenderer {}; value { timeoutSeconds = 30 } }","handlingStrategy":"validation","validationCode":"// plist only supports scalars/strings/data/date\nfunction plistSafeDuration(d: Duration) = d.toUnit(Unit.s).value","typeGuard":null,"tryCatchPattern":"try { renderPlist(value) } catch (e) { if (e.message.contains('cannotRenderType') && e.message.contains('Duration')) renderPlist(convertDurations(value)) else throw e }","preventionTips":["Convert Durations to seconds/strings before plist rendering","Keep plist output schemas free of Pkl-specific types","Test rendering with representative config values"],"tags":["pkl","plist","renderer","unsupported-type","duration"],"backgroundTag":"unsupported-operation","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}