{"record":{"id":"49b418852528623e","repo":"flowable/flowable-engine","slug":"cannot-add-an-entry-criteria-entrycriterion-geti","errorCode":null,"errorMessage":"Cannot add an entry criteria ${entryCriterion.getId()} no matching plan item found to attach it to","messagePattern":"Cannot add an entry criteria (.+?) no matching plan item found to attach it to","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/ConversionHelper.java","lineNumber":126,"sourceCode":"        HasEntryCriteria hasEntryCriteria = null;\n        while (hasEntryCriteria == null && iterator.hasPrevious()) {\n            CmmnElement cmmnElement = iterator.previous();\n            if (cmmnElement instanceof HasEntryCriteria) {\n                hasEntryCriteria = (HasEntryCriteria) cmmnElement;\n            }\n        }\n        if (hasEntryCriteria != null) {\n\n            if (StringUtils.isEmpty(entryCriterion.getId())) {\n                // An id is expected by the evaluation algorithm, so setting an internal one if there isn't one\n                entryCriterion.setId(generateEntryCriterionId(hasEntryCriteria));\n            }\n\n            entryCriterion.setAttachedToRefId(hasEntryCriteria.getId());\n            hasEntryCriteria.getEntryCriteria().add(entryCriterion);\n\n        } else {\n            throw new FlowableException(\"Cannot add an entry criteria \" + entryCriterion.getId() + \" no matching plan item found to attach it to\");\n        }\n    }\n\n    public void addExitCriterion(Criterion exitCriterion) {\n        exitCriteria.add(exitCriterion);\n    }\n\n    public void addExitCriteriaToCurrentElement(Criterion exitCriterion) {\n        addExitCriterion(exitCriterion);\n\n        ListIterator<CmmnElement> iterator = currentCmmnElements.listIterator(currentCmmnElements.size());\n        HasExitCriteria hasExitCriteria = null;\n        while (hasExitCriteria == null && iterator.hasPrevious()) {\n            CmmnElement cmmnElement = iterator.previous();\n            if (cmmnElement instanceof HasExitCriteria) {\n                hasExitCriteria = (HasExitCriteria) cmmnElement;\n            }\n        }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/ConversionHelper.java#L108-L144","documentation":"Thrown by ConversionHelper.addEntryCriterionToCurrentElement when an <entryCriterion> is encountered during conversion but there is no plan item (e.g. a stage, task, or event listener) currently on the stack to attach it to. Entry criteria must belong to a plan item, so a dangling criterion makes the document invalid.","triggerScenarios":"CMMN XML where an <entryCriterion> appears as a child of an element that is not a convertible plan item, or appears where the converter has no current hasEntryCriteria element (e.g. criterion placed directly in a stage instead of inside a planItem).","commonSituations":"Hand-written or third-party-generated CMMN placing entryCriterion outside <planItem>; copy-paste of criteria into the wrong parent; exporters emitting criteria for deleted plan items.","solutions":["Move the <entryCriterion> inside the correct <planItem> element so it has a plan item parent.","Remove the orphaned entry criterion if no plan item should carry it.","Validate the document against the CMMN XSD which enforces criterion placement inside planItem elements."],"exampleFix":"<!-- before -->\n<stage id=\"stage1\">\n  <entryCriterion id=\"crit1\"/>\n</stage>\n<!-- after -->\n<planItem id=\"task1\">\n  <entryCriterion id=\"crit1\"/>\n</planItem>","handlingStrategy":"validation","validationCode":"// Ensure every entryCriterion is a child of a planItem before conversion\n// e.g. XPath check:\n// NodeList bad = (NodeList) xpath.evaluate(\"//entryCriterion[not(parent::planItem)]\", doc, XPathConstants.NODESET);\n// if (bad.getLength() > 0) throw new IllegalArgumentException(\"Entry criteria outside planItem\");","typeGuard":null,"tryCatchPattern":"try {\n    cmmnModel = converter.convertToCmmnModel(stream, encoding);\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"Cannot add an entry criteria\")) {\n        // orphaned entry criterion: fix document structure\n    }\n    throw e;\n}","preventionTips":["Only place entry/exit criteria inside <planItem> elements.","Validate against the CMMN XSD which constrains criterion placement.","Re-check criteria after copy-pasting elements between stages."],"tags":["cmmn","xml-conversion","invalid-structure"],"backgroundTag":"invalid-state-transition","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}