{"record":{"id":"fd0fd5f480438059","repo":"flowable/flowable-engine","slug":"cannot-complete-case-task-parent-process-instance","errorCode":null,"errorMessage":"Cannot complete case task. Parent process instance ${executionEntity} is suspended","messagePattern":"Cannot complete case task\\. Parent process instance (.+?) is suspended","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java","lineNumber":165,"sourceCode":"        // not used\n    }\n    \n    @Override\n    public void completed(DelegateExecution execution) throws Exception {\n        // not used\n    }\n    \n    public void triggerCaseTaskAndLeave(DelegateExecution execution, Map<String, Object> variables) {\n        triggerCaseTask(execution, variables);\n        leave(execution);\n    }\n\n    public void triggerCaseTask(DelegateExecution execution, Map<String, Object> variables) {\n        execution.setVariables(variables);\n        ExecutionEntity executionEntity = (ExecutionEntity) execution;\n\n        if (executionEntity.isSuspended() || ProcessDefinitionUtil.isProcessDefinitionSuspended(execution.getProcessDefinitionId())) {\n            throw new FlowableException(\"Cannot complete case task. Parent process instance \" + executionEntity + \" is suspended\");\n        }\n\n        // Set the reference id and type to null since the execution could be reused\n        executionEntity.setReferenceId(null);\n        executionEntity.setReferenceType(null);\n    }\n}\n","sourceCodeStart":147,"sourceCodeEnd":173,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java#L147-L173","documentation":"CaseTaskActivityBehavior.triggerCaseTask runs when a case task completes and control returns to the process. Before mutating the execution it checks that neither the execution nor its process definition is suspended; otherwise it throws this FlowableException because a suspended process instance must not be driven forward by case completion.","triggerScenarios":"The case linked via a case service task finishes and triggerCaseTask is invoked while executionEntity.isSuspended() or the parent process definition is suspended (ProcessDefinitionUtil.isProcessDefinitionSuspended).","commonSituations":"Admin suspended the parent process definition (without activating instances) while its case instances were still running; the case completes during the suspension window and tries to trigger the waiting process execution.","solutions":["Reactivate the process instance: managementService.activateProcessInstanceById(processInstanceId) and re-trigger.","Reactivate the definition with instances: managementService.activateProcessDefinitionById(definitionId, true, null).","Avoid suspending definitions that have running case tasks; drain or complete linked cases first.","Check suspension state before completing the case: ProcessDefinitionQuery(...).singleResult().isSuspended()."],"exampleFix":"// before: parent suspended, case completion fails\nmanagementService.suspendProcessDefinitionById(\"proc:1:1\", false, null);\n// after\nmanagementService.activateProcessDefinitionById(\"proc:1:1\", true, null); // then complete the case task","handlingStrategy":"try-catch","validationCode":"ProcessInstance pi = managementService.createProcessInstanceQuery().processInstanceId(parentId).singleResult();\nif (pi != null && pi.isSuspended()) managementService.activateProcessInstanceById(parentId);","typeGuard":null,"tryCatchPattern":"try { caseTask.complete(); }\ncatch (FlowableException e) { if (e.getMessage().contains(\"Parent process instance\") && e.getMessage().contains(\"suspended\")) { activateParentThenComplete(); } else { throw e; } }","preventionTips":["Check suspension state before completing cases linked to process tasks.","Activate definitions with instances when ending maintenance.","Track case-task executions when planning suspensions.","Prefer version-scoped suspensions to key-wide freezes."],"tags":["flowable","case-task","suspended","lifecycle"],"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-14T11:17:12.474Z"}