{"record":{"id":"645dfc904905511a","repo":"flowable/flowable-engine","slug":"could-not-resolve-on-part-source-reference-onpar","errorCode":null,"errorMessage":"Could not resolve on part source reference ${onPart.getSourceRef()} of sentry ${sentry.getId()}","messagePattern":"Could not resolve on part source reference (.+?) of sentry (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java","lineNumber":639,"sourceCode":"        for (Criterion exitCriterion : hasExitCriteria.getExitCriteria()) {\n            Sentry sentry = exitCriterion.getParent().findSentry(exitCriterion.getSentryRef());\n            if (sentry != null) {\n                exitCriterion.setSentry(sentry);\n            } else {\n                throw new FlowableException(\"No sentry found for reference \"\n                        + exitCriterion.getSentryRef() + \" of exit criterion \" + exitCriterion.getId());\n            }\n        }\n    }\n\n    protected void processSentries(Stage planModelStage, PlanFragment planFragment) {\n        for (Sentry sentry : planFragment.getSentries()) {\n            for (SentryOnPart onPart : sentry.getOnParts()) {\n                PlanItem planItem = planModelStage.findPlanItemInPlanFragmentOrDownwards(onPart.getSourceRef());\n                if (planItem != null) {\n                    onPart.setSource(planItem);\n                } else {\n                    throw new FlowableException(\"Could not resolve on part source reference \"\n                            + onPart.getSourceRef() + \" of sentry \" + sentry.getId());\n                }\n            }\n        }\n\n        for (PlanItem planItem : planFragment.getPlanItems()) {\n            if (planItem.getPlanItemDefinition() instanceof PlanFragment) {\n                processSentries(planModelStage, (PlanFragment) planItem.getPlanItemDefinition());\n            }\n        }\n    }\n\n    protected void ensureIds(List<? extends BaseElement> elements, String idPrefix) {\n        Map<String, BaseElement> elementsWithId = new HashMap<>();\n        Set<BaseElement> baseElementsWithoutId = new HashSet<>();\n        for (BaseElement baseElement : elements) {\n            if (baseElement.getId() != null) {\n                elementsWithId.put(baseElement.getId(), baseElement);","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java#L621-L657","documentation":"Thrown by CmmnXmlConverter.processSentries when a sentry's onPart references a sourceRef that does not match any plan item in the plan model (searched downwards into nested plan fragments). CMMN sentries react to plan items, so an unresolvable sourceRef means the CMMN XML is inconsistent and conversion aborts.","triggerScenarios":"Parsing a CMMN XML file whose <sentry><planItemOnPart sourceRef=\"X\"> points to a plan item id that does not exist, was renamed, is defined in a different case/plan fragment, or is misspelled.","commonSituations":"Hand-edited or externally generated CMMN XML; refactoring plan item ids without updating sentry on-parts; copy-pasting sentries between cases or stages where the referenced plan item is not in the same plan model hierarchy; tools exporting partial plan models.","solutions":["Fix the sourceRef attribute of the planItemOnPart so it matches the id of an existing <planItem> in the same plan fragment or a nested one.","Remove or restructure the sentry if its source plan item was intentionally deleted.","Validate the CMMN XML against the XSD and cross-check all sourceRef/targetRef ids before deployment."],"exampleFix":"<!-- before -->\n<sentry id=\"sentry1\">\n  <planItemOnPart sourceRef=\"oldPlanItemId\"/>\n</sentry>\n<!-- after -->\n<sentry id=\"sentry1\">\n  <planItemOnPart sourceRef=\"existingPlanItemId\"/>\n</sentry>","handlingStrategy":"validation","validationCode":"// Pre-validate all sentry on-part sourceRefs before conversion\nfor (Sentry sentry : planFragment.getSentries()) {\n    for (SentryOnPart onPart : sentry.getOnParts()) {\n        if (planModelStage.findPlanItemInPlanFragmentOrDownwards(onPart.getSourceRef()) == null) {\n            throw new IllegalArgumentException(\"Unresolved onPart sourceRef: \" + onPart.getSourceRef());\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    cmmnModel = converter.convertToCmmnModel(inputStream, encoding);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"Could not resolve on part source reference\")) {\n        // flag the offending CMMN document for authoring-time validation\n    }\n    throw e;\n}","preventionTips":["Author CMMN in an editor with schema/XSD validation and id reference checking.","Never hand-edit planItem ids without searching the whole file for referencing sourceRef/targetRef attributes.","Run automated id-reference linting on CMMN files in CI before deployment."],"tags":["cmmn","xml-conversion","broken-reference"],"backgroundTag":"resource-not-found","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"}