flowable/flowable-engine · error · FlowableException

No execution could be found with a case service task for

Error message

No execution could be found with a case service task for ${execution}

What it means

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.

Solutions

  1. Verify with ExecutionQuery/execution.getCurrentFlowElement() that the active element is a caseServiceTask
  2. Trigger on the correct child execution id (concurrent branches have their own executions)
  3. Update the triggering code to match the current BPMN model element type
  4. If the case task already completed, treat the trigger as a no-op instead of re-triggering

Example fix

// before
trigger(execution.getId(), vars); // blind trigger
// after
if (execution.getCurrentFlowElement() instanceof CaseServiceTask) {
    trigger(execution.getId(), vars);
}
Defensive patterns

Strategy: validation

Validate before calling

ExecutionEntity exec = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(id).singleResult();
if (exec != null && !(exec.getCurrentFlowElement() instanceof CaseServiceTask)) {
    throw new IllegalStateException("active element is not a case task");
}

Type guard

boolean isCaseTaskExecution(org.flowable.engine.runtime.Execution e) {
    return e instanceof ExecutionEntity ent
        && ent.getCurrentFlowElement() instanceof CaseServiceTask;
}

Try / catch

try {
    trigger(executionId, vars);
} catch (FlowableException e) {
    if (e.getMessage().contains("not supported for a case task") || e.getMessage().contains("case service task")) {
        // inspect currentFlowElement and pick the right trigger API
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/cf887019f0e927a9. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/TriggerCaseTaskCmd.java:61

        if (executionId == null) {
            throw new FlowableIllegalArgumentException("executionId is null");
        }
        
        this.variables = variables;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getExecutionEntityManager().findById(executionId);
        if (execution == null) {
            throw new FlowableException("No execution could be found for id " + executionId);
        }
        
        FlowElement flowElement = execution.getCurrentFlowElement();
        if (!(flowElement instanceof CaseServiceTask caseServiceTask)) {
            throw new FlowableException("No execution could be found with a case service task for " + execution);
        }

        Object behavior = caseServiceTask.getBehavior();
        if (behavior instanceof CaseTaskActivityBehavior) {
            ((CaseTaskActivityBehavior) behavior).triggerCaseTaskAndLeave(execution, variables);
        } else if (behavior instanceof MultiInstanceActivityBehavior) {
            AbstractBpmnActivityBehavior innerActivityBehavior = ((MultiInstanceActivityBehavior) behavior).getInnerActivityBehavior();
            if (innerActivityBehavior instanceof CaseTaskActivityBehavior) {
                ((CaseTaskActivityBehavior) innerActivityBehavior).triggerCaseTask(execution, variables);
            } else {
                throw new FlowableException("Multi instance inner behavior " + innerActivityBehavior + " is not supported for " + execution);
            }
            ((MultiInstanceActivityBehavior) behavior).leave(execution);
        } else {
                throw new FlowableException("Behavior " + behavior + " is not supported for a case task for " + execution);
        }

        return null;

View on GitHub (pinned to d6d39ce1c6)