flowable/flowable-engine · error · FlowableException

Error converting condition

Error message

Error converting condition

What it means

Thrown by ConditionXmlConverter.convert when an XMLStreamException occurs while reading a CMMN <condition> element (for ifPart or planItemRule). It wraps low-level XML parsing failure (malformed content, unexpected end of document, invalid characters) into a FlowableException.

Source

Thrown at modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/ConditionXmlConverter.java:52

    @Override
    public boolean hasChildElements() {
        return false;
    }

    @Override
    protected CmmnElement convert(XMLStreamReader xtr, ConversionHelper conversionHelper) {
        try {
            String condition = xtr.getElementText();
            if (StringUtils.isNotEmpty(condition)) {
                CmmnElement currentCmmnElement = conversionHelper.getCurrentCmmnElement();
                if (currentCmmnElement instanceof SentryIfPart) {
                    ((SentryIfPart) currentCmmnElement).setCondition(condition);
                } else if (currentCmmnElement instanceof PlanItemRule) {
                    ((PlanItemRule) currentCmmnElement).setCondition(condition);
                }
            }
        } catch (XMLStreamException e) {
            throw new FlowableException("Error converting condition", e);
        }
        return null;
    }
    
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Validate the CMMN XML file with an XML parser/linter and fix malformed markup around the <condition> element.
  2. Escape XML-special characters in the condition expression (&amp;, &lt;, &gt;).
  3. Ensure the file encoding matches the XML declaration and the file is complete (not truncated).

Example fix

<!-- before -->
<condition>${var &lt 5 && var > 1}</condition>
<!-- after -->
<condition>${var &lt; 5 &amp;&amp; var &gt; 1}</condition>
Defensive patterns

Strategy: validation

Validate before calling

// Parse the XML with a strict parser before handing it to Flowable
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
f.setValidating(true);
Document doc = f.newDocumentBuilder().parse(cmmnFile); // throws on malformed condition markup

Try / catch

try {
    cmmnModel = converter.convertToCmmnModel(stream, encoding);
} catch (FlowableException e) {
    if ("Error converting condition".equals(e.getMessage()) && e.getCause() instanceof XMLStreamException) {
        // locate and repair the malformed <condition> element
    }
    throw e;
}

Prevention

When it happens

Trigger: xtr.getElementText() or related stream reads throw XMLStreamException: malformed XML inside <condition>, unclosed tags, document truncated mid-element, or invalid encoding/characters.

Common situations: Corrupt or hand-truncated CMMN file; XML with wrong encoding declaration; condition bodies containing unescaped characters (e.g. raw & or < in expressions); files edited by non-XML-safe tools.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/877d0c14785cafda. Report an issue: GitHub.