{"record":{"id":"193ae2cf99e9557b","repo":"flowable/flowable-engine","slug":"cannot-trigger-case-task-plan-item-instance-refe","errorCode":null,"errorMessage":"Cannot trigger case task plan item instance : reference type '${referenceType}' not supported","messagePattern":"Cannot trigger case task plan item instance : reference type '(.+?)' not supported","errorType":"exception","errorClass":"FlowableIllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java","lineNumber":172,"sourceCode":"                    .handleFormFieldsOnSubmit(variableInfo.formInfo, null, null, caseInstanceEntity.getId(), ScopeTypes.CMMN,\n                            variablesFromFormSubmission, caseInstanceEntity.getTenantId());\n        }\n\n        if (!blocking) {\n            CommandContextUtil.getAgenda(commandContext).planCompletePlanItemInstanceOperation(planItemInstanceEntity);\n        }\n    }\n\n    @Override\n    public void trigger(CommandContext commandContext, PlanItemInstanceEntity planItemInstance) {\n        if (!PlanItemInstanceState.ACTIVE.equals(planItemInstance.getState())) {\n            throw new FlowableIllegalStateException(\"Can only trigger a plan item that is in the ACTIVE state\");\n        }\n        if (planItemInstance.getReferenceId() == null) {\n            throw new FlowableIllegalStateException(\"Cannot trigger case task plan item instance : no reference id set\");\n        }\n        if (!ReferenceTypes.PLAN_ITEM_CHILD_CASE.equals(planItemInstance.getReferenceType())) {\n            throw new FlowableIllegalStateException(\"Cannot trigger case task plan item instance : reference type '\"\n                    + planItemInstance.getReferenceType() + \"' not supported\");\n        }\n\n        // load the case instance referenced by this case task plan item to check its current state\n        CaseInstanceEntity caseInstance = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(planItemInstance.getReferenceId());\n\n        if (caseInstance != null) {\n            // Out parameters are handled here only when the case is still active (manual trigger scenario).\n            // When the child case completed normally, out parameters are already handled\n            // in ChildCaseInstanceStateChangeCallback before the child case gets deleted.\n            handleOutParameters(commandContext, planItemInstance);\n\n            if (caseInstance.getState().equals(CaseInstanceState.ACTIVE)) {\n                // Triggering the plan item (as opposed to a regular complete of the referenced case) manually terminates the case instance\n                CommandContextUtil.getAgenda(commandContext).planManualTerminateCaseInstanceOperation(planItemInstance.getReferenceId());\n            }\n        }\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java#L154-L190","documentation":"After checking referenceId, CaseTaskActivityBehavior.trigger validates that referenceType equals ReferenceTypes.PLAN_ITEM_CHILD_CASE. Any other reference type means this plan item is not backed by a child case, so triggering it as a case task is unsupported and this error is thrown.","triggerScenarios":"Triggering a plan item instance whose referenceType is something other than PLAN_ITEM_CHILD_CASE — e.g. data from a different behavior type was reused, or instance data was migrated/corrupted across task types.","commonSituations":"Mixing up ids of case task and process task (child process) plan items when calling triggerPlanItemInstance; runtime data migrated from another engine version or another task type; custom behaviors setting their own reference types.","solutions":["Ensure the planItemInstanceId passed to triggerPlanItemInstance belongs to a case task plan item.","Check planItemInstance.getReferenceType() equals PLAN_ITEM_CHILD_CASE before triggering.","Use the behavior-appropriate completion path for other task types (e.g. process task handled via the child process).","Audit runtime tables for corrupted reference_type values if this occurs without user error."],"exampleFix":"// before\nruntimeService.triggerPlanItemInstance(id); // plan item is a child-process task\n// after\nPlanItemInstance pii = runtimeService.createPlanItemInstanceQuery()\n    .planItemInstanceId(id).singleResult();\nif (ReferenceTypes.PLAN_ITEM_CHILD_CASE.equals(pii.getReferenceType())) {\n    runtimeService.triggerPlanItemInstance(id);\n}","handlingStrategy":"validation","validationCode":"PlanItemInstance pii = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceId(id).singleResult();\nboolean isChildCase = pii != null && ReferenceTypes.PLAN_ITEM_CHILD_CASE.equals(pii.getReferenceType());","typeGuard":null,"tryCatchPattern":"try {\n    cmmnRuntimeService.triggerPlanItemInstance(id);\n} catch (FlowableIllegalStateException e) {\n    if (e.getMessage().contains(\"reference type\")) {\n        // wrong plan item type passed — route to the correct completion API\n    }\n}","preventionTips":["Match plan item ids to their task type before triggering","Check referenceType before programmatic completion","Avoid sharing trigger code across case task and process task plan items","Audit reference_type values after data migrations"],"tags":["cmmn","case-task","reference-type","unsupported"],"backgroundTag":"invalid-argument-value","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"}