{"record":{"id":"cf887019f0e927a9","repo":"flowable/flowable-engine","slug":"no-execution-could-be-found-with-a-case-service-ta","errorCode":null,"errorMessage":"No execution could be found with a case service task for ${execution}","messagePattern":"No execution could be found with a case service task for (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java","lineNumber":61,"sourceCode":"\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n        \n        this.variables = variables;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getExecutionEntityManager().findById(executionId);\n        if (execution == null) {\n            throw new FlowableException(\"No execution could be found for id \" + executionId);\n        }\n        \n        FlowElement flowElement = execution.getCurrentFlowElement();\n        if (!(flowElement instanceof CaseServiceTask caseServiceTask)) {\n            throw new FlowableException(\"No execution could be found with a case service task for \" + execution);\n        }\n\n        Object behavior = caseServiceTask.getBehavior();\n        if (behavior instanceof CaseTaskActivityBehavior) {\n            ((CaseTaskActivityBehavior) behavior).triggerCaseTaskAndLeave(execution, variables);\n        } else if (behavior instanceof MultiInstanceActivityBehavior) {\n            AbstractBpmnActivityBehavior innerActivityBehavior = ((MultiInstanceActivityBehavior) behavior).getInnerActivityBehavior();\n            if (innerActivityBehavior instanceof CaseTaskActivityBehavior) {\n                ((CaseTaskActivityBehavior) innerActivityBehavior).triggerCaseTask(execution, variables);\n            } else {\n                throw new FlowableException(\"Multi instance inner behavior \" + innerActivityBehavior + \" is not supported for \" + execution);\n            }\n            ((MultiInstanceActivityBehavior) behavior).leave(execution);\n        } else {\n                throw new FlowableException(\"Behavior \" + behavior + \" is not supported for a case task for \" + execution);\n        }\n\n        return null;","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java#L43-L79","documentation":"The execution was found, but its currentFlowElement is not a CaseServiceTask, so TriggerCaseTaskCmd cannot trigger a case task on it. This error indicates a mismatch between the element actually active at the execution and the element the caller expected.","triggerScenarios":"Calling the trigger-case-task path when the execution's current flow element is a user task, service task, gateway, or any BPMN element other than a CaseServiceTask.","commonSituations":"The BPMN was redesigned so the element is no longer a case task while old triggering code remained; triggering on the wrong (e.g. parent/concurrent) execution; process advanced past the case task before the trigger arrived.","solutions":["Verify with ExecutionQuery/execution.getCurrentFlowElement() that the active element is a caseServiceTask","Trigger on the correct child execution id (concurrent branches have their own executions)","Update the triggering code to match the current BPMN model element type","If the case task already completed, treat the trigger as a no-op instead of re-triggering"],"exampleFix":"// before\ntrigger(execution.getId(), vars); // blind trigger\n// after\nif (execution.getCurrentFlowElement() instanceof CaseServiceTask) {\n    trigger(execution.getId(), vars);\n}","handlingStrategy":"validation","validationCode":"ExecutionEntity exec = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(id).singleResult();\nif (exec != null && !(exec.getCurrentFlowElement() instanceof CaseServiceTask)) {\n    throw new IllegalStateException(\"active element is not a case task\");\n}","typeGuard":"boolean isCaseTaskExecution(org.flowable.engine.runtime.Execution e) {\n    return e instanceof ExecutionEntity ent\n        && ent.getCurrentFlowElement() instanceof CaseServiceTask;\n}","tryCatchPattern":"try {\n    trigger(executionId, vars);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"not supported for a case task\") || e.getMessage().contains(\"case service task\")) {\n        // inspect currentFlowElement and pick the right trigger API\n    }\n}","preventionTips":["Match trigger code to the actual BPMN element types after model changes","Trigger child executions, not the process-instance root, for concurrent branches","Keep model and trigger logic covered by integration tests"],"tags":["case-task","element-type-mismatch","execution"],"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"}