{"record":{"id":"ee9893f94d4a585e","repo":"flowable/flowable-engine","slug":"error-while-reading-the-cmmn-1-1-xml","errorCode":null,"errorMessage":"Error while reading the CMMN 1.1 XML","messagePattern":"Error while reading the CMMN 1\\.1 XML","errorType":"exception","errorClass":"CmmnXMLException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java","lineNumber":189,"sourceCode":"        if (xif.isPropertySupported(XMLConstants.ACCESS_EXTERNAL_SCHEMA)) {\n            xif.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n        }\n\n        if (encoding == null) {\n            encoding = DEFAULT_ENCODING;\n        }\n\n        if (validateSchema) {\n            try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {\n                if (!enableSafeBpmnXml) {\n                    validateModel(inputStreamProvider);\n                } else {\n                    validateModel(new FlowableXMLStreamReader(xif.createXMLStreamReader(in)));\n                }\n            } catch (UnsupportedEncodingException e) {\n                throw new CmmnXMLException(\"The CMMN 1.1 xml is not properly encoded\", e);\n            } catch (XMLStreamException e) {\n                throw new CmmnXMLException(\"Error while reading the CMMN 1.1 XML\", e);\n            } catch (Exception e) {\n                throw new CmmnXMLException(e.getMessage(), e);\n            }\n        }\n        // The input stream is closed after schema validation\n        try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {\n            // XML conversion\n            return convertToCmmnModel(xif.createXMLStreamReader(in));\n        } catch (UnsupportedEncodingException e) {\n            throw new CmmnXMLException(\"The CMMN 1.1 xml is not properly encoded\", e);\n        } catch (XMLStreamException e) {\n            throw new CmmnXMLException(\"Error while reading the CMMN 1.1 XML\", e);\n        } catch (IOException e) {\n            throw new CmmnXMLException(e.getMessage(), e);\n        }\n    }\n\n    public CmmnModel convertToCmmnModel(XMLStreamReader xtr) {","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java#L171-L207","documentation":"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.","triggerScenarios":"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).","commonSituations":"Deploying an empty or truncated .cmmn file; files with BOM/encoding mismatch; non-XML content uploaded as CMMN; network-backed InputStream failing mid-read.","solutions":["Inspect the cause XMLStreamException for line/column of the parse failure","Ensure the .cmmn resource is complete, well-formed XML","Check the file encoding/BOM matches the declared encoding","Re-export the case model from the CMMN editor"],"exampleFix":"// before\ndeploymentBuilder.addInputStream(\"case.cmmn\", new FileInputStream(truncatedFile));\n// after\nString xml = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);\nif (!xml.trim().endsWith(\">\")) { throw new IllegalStateException(\"truncated cmmn\"); }\ndeploymentBuilder.addInputStream(\"case.cmmn\", new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));","handlingStrategy":"validation","validationCode":"byte[] bytes = Files.readAllBytes(path);\nString head = new String(bytes, 0, Math.min(bytes.length, 100), StandardCharsets.UTF_8).trim();\nif (bytes.length == 0 || !head.startsWith(\"<\")) throw new IllegalArgumentException(\"Not valid CMMN XML content\");","typeGuard":null,"tryCatchPattern":"try { converter.convertToCmmnModel(provider); } catch (CmmnXMLException e) { log.error(\"XML read failed at: {}\", e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); throw e; }","preventionTips":["Ensure .cmmn resources are complete and well-formed XML","Match declared encoding to actual file encoding/BOM","Do not upload non-XML content with .cmmn extension","Validate externally (xmllint) before deployment"],"tags":["cmmn","xml","parsing","conversion"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}