apple/pkl · error · VmException

inlineNotSupportedHere

inlineNotSupportedHere

Error message

inlineNotSupportedHere

What it means

While rendering XML, a `Typed` object recognized as an inline XML value (satisfies `isXmlInline`) appeared where the renderer cannot emit it. The renderer throws instead of producing malformed output.

Solutions

  1. Place the inline value where the renderer accepts it (inside element content)
  2. Convert the inline node to a regular XmlElement-shaped Dynamic object
  3. Render the value to a string first if only text is allowed at that position
  4. Verify you are using the intended XML rendering entry point from pkl-xml

Example fix

// before
attr = xmlInline("...")   // inline value in attribute slot
// after
content { xmlInline("...") }
Defensive patterns

Strategy: validation

Validate before calling

function isInline(v: Any): Boolean = v is Typed && v.hasClassProperty("xmlInline") // adapt to pkl-xml API

Type guard

function renderableHere(v: Any): Boolean = !(v is Typed) || !isXmlInlineValue(v)

Prevention

When it happens

Trigger: An Xml-inline class instance (from pkl-xml's `XmlInline` machinery) is visited in an unsupported position, e.g. as an attribute value or top-level in a mode that doesn't accept inline nodes.

Common situations: Mixing pkl-xml inline/element abstractions with the generic XML renderer output path; nesting inline nodes where only elements or text are allowed.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/19579fd44cc7f0db. Report an issue: GitHub.

Appendix: source

Thrown at pkl-core/src/main/java/org/pkl/core/stdlib/xml/RendererNodes.java:193

    @Override
    public void visitIntSeq(VmIntSeq value) {
      cannotRenderTypeAddConverter(value);
    }

    @Override
    protected void startDynamic(VmDynamic value) {
      if (isXmlElement(value)) {
        throw new VmExceptionBuilder()
            .evalError("elementNotSupportedHere")
            .withProgramValue("Value", value)
            .build();
      }
    }

    @Override
    public void startTyped(VmTyped value) {
      if (isXmlInline(value)) {
        throw new VmExceptionBuilder()
            .evalError("inlineNotSupportedHere")
            .withProgramValue("Value", value)
            .build();
      }
    }

    // No-op for XML
    @Override
    protected void startListing(VmListing value) {}

    // No-op for XML
    @Override
    protected void startMapping(VmMapping value) {}

    // No-op for XML
    @Override
    protected void startList(VmList value) {}

View on GitHub (pinned to f3efcbfc9b)