{"record":{"id":"3e111e149e89efba","repo":"apple/pkl","slug":"elementnotsupportedhere","errorCode":"elementNotSupportedHere","errorMessage":"elementNotSupportedHere","messagePattern":"elementNotSupportedHere","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/stdlib/xml/RendererNodes.java","lineNumber":183,"sourceCode":"    @Override\n    public void visitPair(VmPair value) {\n      cannotRenderTypeAddConverter(value);\n    }\n\n    @Override\n    public void visitRegex(VmRegex value) {\n      cannotRenderTypeAddConverter(value);\n    }\n\n    @Override\n    public void visitIntSeq(VmIntSeq value) {\n      cannotRenderTypeAddConverter(value);\n    }\n\n    @Override\n    protected void startDynamic(VmDynamic value) {\n      if (isXmlElement(value)) {\n        throw new VmExceptionBuilder()\n            .evalError(\"elementNotSupportedHere\")\n            .withProgramValue(\"Value\", value)\n            .build();\n      }\n    }\n\n    @Override\n    public void startTyped(VmTyped value) {\n      if (isXmlInline(value)) {\n        throw new VmExceptionBuilder()\n            .evalError(\"inlineNotSupportedHere\")\n            .withProgramValue(\"Value\", value)\n            .build();\n      }\n    }\n\n    // No-op for XML\n    @Override","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/stdlib/xml/RendererNodes.java#L165-L201","documentation":"When rendering XML, a `Dynamic` object that was recognized as an XML element (or inline value) appeared in a position where the renderer does not support it. The renderer throws `elementNotSupportedHere` with the offending value instead of emitting invalid XML.","triggerScenarios":"A `Dynamic` value satisfying `isXmlElement` (has `name`/`attributes`/`content` members) is visited at a position in the XML output where an element cannot be started, e.g. as an attribute value or inside a property that is not rendered as element content.","commonSituations":"See trigger scenarios.","solutions":["Move the element-shaped Dynamic into a position rendered as XML content (e.g. a `content` Listing)","If it is data, not XML, rename its `name` member or use a plain object so it is not detected as an XmlElement","Render only scalar values in attribute positions","Check the pkl-xml library version and supported nesting rules"],"exampleFix":"// before\nperson { name = xmlElement(\"a\", ...) }  // element in attribute position\n// after\nperson { content { xmlElement(\"a\", ...) } }","handlingStrategy":"validation","validationCode":"// Pkl: only place XmlElement-shaped objects where the renderer starts elements\nfunction looksLikeElement(d: Dynamic): Boolean = d.hasProperty(\"name\") && d.hasProperty(\"content\")","typeGuard":"function isScalar(v: Any): Boolean = v is String || v is Boolean || v is Number || v is Null","tryCatchPattern":null,"preventionTips":["Nest element-shaped objects only inside content positions","Keep scalar-only values in attribute positions","Follow pkl-xml library nesting conventions"],"tags":["xml","rendering","dynamic","pkl"],"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"}