flowable/flowable-engine · error · CmmnXMLException

Error while reading the CMMN 1.1 XML

Error message

Error while reading the CMMN 1.1 XML

What it means

In the same validation path of CmmnXmlConverter.convertToCmmnModel, failures to read the XML stream (XMLStreamException) are wrapped as CmmnXMLException 'Error while reading the CMMN 1.1 XML', indicating the parser could not read the document during validation.

Source

Thrown at modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java:189

        if (xif.isPropertySupported(XMLConstants.ACCESS_EXTERNAL_SCHEMA)) {
            xif.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
        }

        if (encoding == null) {
            encoding = DEFAULT_ENCODING;
        }

        if (validateSchema) {
            try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {
                if (!enableSafeBpmnXml) {
                    validateModel(inputStreamProvider);
                } else {
                    validateModel(new FlowableXMLStreamReader(xif.createXMLStreamReader(in)));
                }
            } catch (UnsupportedEncodingException e) {
                throw new CmmnXMLException("The CMMN 1.1 xml is not properly encoded", e);
            } catch (XMLStreamException e) {
                throw new CmmnXMLException("Error while reading the CMMN 1.1 XML", e);
            } catch (Exception e) {
                throw new CmmnXMLException(e.getMessage(), e);
            }
        }
        // The input stream is closed after schema validation
        try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {
            // XML conversion
            return convertToCmmnModel(xif.createXMLStreamReader(in));
        } catch (UnsupportedEncodingException e) {
            throw new CmmnXMLException("The CMMN 1.1 xml is not properly encoded", e);
        } catch (XMLStreamException e) {
            throw new CmmnXMLException("Error while reading the CMMN 1.1 XML", e);
        } catch (IOException e) {
            throw new CmmnXMLException(e.getMessage(), e);
        }
    }

    public CmmnModel convertToCmmnModel(XMLStreamReader xtr) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the cause XMLStreamException for line/column of the parse failure
  2. Ensure the .cmmn resource is complete, well-formed XML
  3. Check the file encoding/BOM matches the declared encoding
  4. Re-export the case model from the CMMN editor

Example fix

// before
deploymentBuilder.addInputStream("case.cmmn", new FileInputStream(truncatedFile));
// after
String xml = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
if (!xml.trim().endsWith(">")) { throw new IllegalStateException("truncated cmmn"); }
deploymentBuilder.addInputStream("case.cmmn", new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
Defensive patterns

Strategy: validation

Validate before calling

byte[] bytes = Files.readAllBytes(path);
String head = new String(bytes, 0, Math.min(bytes.length, 100), StandardCharsets.UTF_8).trim();
if (bytes.length == 0 || !head.startsWith("<")) throw new IllegalArgumentException("Not valid CMMN XML content");

Try / catch

try { converter.convertToCmmnModel(provider); } catch (CmmnXMLException e) { log.error("XML read failed at: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); throw e; }

Prevention

When it happens

Trigger: convertToCmmnModel invoked with a corrupted, truncated, or unreadable XML stream; the underlying XMLEventReader/XMLStreamReader throws XMLStreamException while creating or advancing the reader (invalid XML syntax).

Common situations: Deploying an empty or truncated .cmmn file; files with BOM/encoding mismatch; non-XML content uploaded as CMMN; network-backed InputStream failing mid-read.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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