{"record":{"id":"60a9e6885e40bcef","repo":"flowable/flowable-engine","slug":"cannot-find-plan-item-with-definition-id-planite","errorCode":null,"errorMessage":"Cannot find plan item with definition id '<planItemDefinitionId>' in case definition with id '<caseDefinitionId>'","messagePattern":"Cannot find plan item with definition id '<planItemDefinitionId>' in case definition with id '<caseDefinitionId>'","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/AbstractCmmnDynamicStateManager.java","lineNumber":112,"sourceCode":"/**\n * @author Tijs Rademakers\n * @author Valentin Zickner\n */\npublic abstract class AbstractCmmnDynamicStateManager {\n\n    protected final Logger LOGGER = LoggerFactory.getLogger(this.getClass());\n    \n    protected CmmnEngineConfiguration cmmnEngineConfiguration;\n    \n    public AbstractCmmnDynamicStateManager(CmmnEngineConfiguration cmmnEngineConfiguration) {\n        this.cmmnEngineConfiguration = cmmnEngineConfiguration;\n    }\n\n    protected PlanItem resolvePlanItemFromCmmnModelWithDefinitionId(String planItemDefinitionId, String caseDefinitionId) {\n        CmmnModel cmmnModel = CaseDefinitionUtil.getCmmnModel(caseDefinitionId);\n        PlanItem planItem = cmmnModel.findPlanItemByPlanItemDefinitionId(planItemDefinitionId);\n        if (planItem == null) {\n            throw new FlowableException(\"Cannot find plan item with definition id '\" + planItemDefinitionId + \"' in case definition with id '\" + caseDefinitionId + \"'\");\n        }\n        return planItem;\n    }\n\n    protected PlanItem resolvePlanItemFromCmmnModel(CmmnModel cmmnModel, String planItemId, String caseDefinitionId) {\n        PlanItem planItem = cmmnModel.findPlanItem(planItemId);\n        if (planItem == null) {\n            throw new FlowableException(\"Cannot find plan item '\" + planItemId + \"' in case definition with id '\" + caseDefinitionId + \"'\");\n        }\n        return planItem;\n    }\n\n    protected void doMovePlanItemState(CaseInstanceChangeState caseInstanceChangeState, String originalCaseDefinitionId, CommandContext commandContext) {\n        CaseInstanceEntityManager caseInstanceEntityManager = cmmnEngineConfiguration.getCaseInstanceEntityManager();\n        CaseInstanceEntity caseInstance = caseInstanceEntityManager.findById(caseInstanceChangeState.getCaseInstanceId());\n        \n        Map<String, List<PlanItemInstanceEntity>> currentPlanItemInstances = retrievePlanItemInstances(caseInstanceChangeState.getCaseInstanceId());\n        caseInstanceChangeState.setCurrentPlanItemInstances(currentPlanItemInstances);","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/AbstractCmmnDynamicStateManager.java#L94-L130","documentation":"Flowable throws this FlowableException when a dynamic CMMN case modification cannot resolve a plan item in the loaded CMMN model by plan item definition id. resolvePlanItemFromCmmnModelWithDefinitionId looks up the element via CmmnModel.findPlanItemByPlanItemDefinitionId and aborts when no matching plan item exists in the target case definition.","triggerScenarios":"Calling case modification/change-state APIs such as planItem(...) on CaseChangeStateRequest/builders with a planItemDefinitionId that does not exist in the case definition identified by caseDefinitionId — e.g. after redeploying a changed case model, using an id from a different case, or a typo in the definition id.","commonSituations":"Case migration between case definition versions where a plan item was renamed or removed; runtime operations referencing a stale case definition id after a new deployment; programmatically generated definition ids not matching the deployed CMMN XML.","solutions":["Verify planItemDefinitionId exists in the deployed case's CMMN XML (<planItem> whose planItemDefinition has that id)","Confirm the caseDefinitionId points to the case definition version that actually contains the plan item (check ACT_CMMN_CASEDEF / repository)","Re-fetch the case definition and list its plan items (e.g. via the CmmnModel) to pick a valid id","If the case model changed, update the change-state/migration request to use the new definition ids"],"exampleFix":"// before\nchangeStateBuilder.planItem(\"nonexistentStepId\", \"caseDef-1\");\n// after\nCmmnModel model = CaseDefinitionUtil.getCmmnModel(\"caseDef-1\");\nif (model.findPlanItemByPlanItemDefinitionId(\"stepId\") != null) {\n    changeStateBuilder.planItem(\"stepId\", \"caseDef-1\");\n}","handlingStrategy":"validation","validationCode":"CmmnModel model = CaseDefinitionUtil.getCmmnModel(caseDefinitionId);\nif (model.findPlanItemByPlanItemDefinitionId(planItemDefinitionId) == null) {\n    throw new IllegalArgumentException(\"Unknown planItemDefinitionId: \" + planItemDefinitionId);\n}","typeGuard":"boolean planItemExists = cmmnModel.findPlanItemByPlanItemDefinitionId(planItemDefinitionId) != null;","tryCatchPattern":"try {\n    changeStateBuilder.planItem(planItemDefinitionId, caseDefinitionId);\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"Cannot find plan item\")) {\n        // refresh case definition ids and retry with corrected ids\n    }\n}","preventionTips":["Extract plan item definition ids from the deployed case definition version, not from older deployments","Revalidate ids after redeploying changed CMMN models","Keep case migration requests in sync with renamed/removed plan items","Log the available plan item definition ids when resolution fails to speed up diagnosis"],"tags":["java","flowable","cmmn","plan-item","resource-not-found"],"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-14T11:17:12.474Z"}