flowable/flowable-engine · warning

Error while moving to end of element

Error message

Error while moving to end of element {}

What it means

This is a warning logged (not a thrown exception) by XMLStreamReaderUtil.moveToEndOfElement, which advances the stream reader past the closing tag of the named element. On any exception while skipping forward it logs a warning, returns false, and leaves the cursor wherever it stopped, so the parent converter may continue parsing from a wrong position and drop or duplicate elements.

Solutions

  1. Check XML well-formedness with xmllint --noout before feeding the file to the converter; fix unclosed/mismatched tags
  2. Read the logged cause to find the exact offset where scanning stopped
  3. Re-export the model from the Flowable modeler to regenerate clean XML
  4. Compare the file against a known-good version (git diff) to spot the broken tag

Example fix

<!-- before: unclosed element breaks moveToEndOfElement -->
<decisionService id="ds1">
  <outputData output="out_1">
<!-- after: properly closed -->
<decisionService id="ds1">
  <outputData output="out_1" />
</decisionService>
Defensive patterns

Strategy: validation

Validate before calling

// Well-formedness check guarantees every start element has a matching end element
XMLInputFactory f = XMLInputFactory.newFactory();
f.createXMLStreamReader(new FileInputStream("process.bpmn20.xml")).close(); // throws if tags mismatch

Try / catch

// moveToToEndOfElement returns false on error; branch on the boolean
if (!XMLStreamReaderUtil.moveToEndOfElement(xtr, "decisionService")) {
  throw new IllegalStateException("Failed to skip to end of decisionService element; XML likely malformed");
}

Prevention

When it happens

Trigger: Calling moveToEndOfElement(xtr, elementName) when the matching closing tag never appears (unterminated element) or the stream throws an XMLStreamException while scanning for the end element inside malformed XML.

Common situations: DMN files with mismatched or unclosed tags after hand-editing; a truncated upload; generated XML where an element's closing tag was accidentally deleted; deep nesting that a manual merge broke.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/XMLStreamReaderUtil.java:62

        return null;
    }

    public static boolean moveToEndOfElement(XMLStreamReader xtr, String elementName) {
        try {
            while (xtr.hasNext()) {
                int event = xtr.next();
                switch (event) {
                case XMLStreamConstants.END_DOCUMENT:
                    return false;
                case XMLStreamConstants.END_ELEMENT:
                    if (xtr.getLocalName().equals(elementName)) {
                        return true;
                    }
                    break;
                }
            }
        } catch (Exception e) {
            LOGGER.warn("Error while moving to end of element {}", elementName, e);
        }
        return false;
    }
}

View on GitHub (pinned to d6d39ce1c6)