flowable/flowable-engine · error · FlowableException
is created by the process engine and should be completed vi
Error message
is created by the process engine and should be completed via the process engine API
What it means
Thrown when CompleteTaskCmd finds the task but the task has a non-empty processInstanceId, meaning it was created by the BPMN process engine, not the CMMN engine. The CMMN API refuses to complete it because lifecycle ownership belongs to the process engine; completing it via CMMN would corrupt the process state.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskCmd.java:90
this(taskId, variables, variablesLocal, transientVariables, transientVariablesLocal);
this.userId = userId;
}
@Override
public Void execute(CommandContext commandContext) {
if (taskId == null) {
throw new FlowableIllegalArgumentException("Null task id");
}
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
TaskEntity taskEntity = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);
if (taskEntity == null) {
throw new FlowableObjectNotFoundException("Could not find task entity for id " + taskId, TaskEntity.class);
}
if (StringUtils.isNotEmpty(taskEntity.getProcessInstanceId())) {
throw new FlowableException(taskEntity + " is created by the process engine and should be completed via the process engine API");
}
String planItemInstanceId = taskEntity.getSubScopeId();
PlanItemInstanceEntity planItemInstanceEntity = null;
if (planItemInstanceId != null) {
planItemInstanceEntity = cmmnEngineConfiguration.getPlanItemInstanceEntityManager().findById(planItemInstanceId);
if (planItemInstanceEntity == null) {
throw new FlowableException("Could not find plan item instance for " + taskEntity);
}
}
if (variables != null) {
taskEntity.setVariables(variables);
}
if (variablesLocal != null) {
taskEntity.setVariablesLocal(variablesLocal);
}
if (transientVariables != null) {View on GitHub (pinned to d6d39ce1c6)
Solutions
- Detect process tasks first (task.getProcessInstanceId() != null) and complete them with the BPMN TaskService: processTaskService.complete(taskId).
- Route completion through the engine that created the task rather than a hardcoded CMMN task service.
- If both engines share a task service, query with taskQuery().processInstanceId() vs caseInstanceId to split handling.
Example fix
// before
cmmnTaskService.completeTask(taskId);
// after
org.flowable.task.api.Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
if (t.getProcessInstanceId() != null) {
processTaskService.complete(taskId); // BPMN engine owns this task
} else {
cmmnTaskService.completeTask(taskId);
} Defensive patterns
Strategy: validation
Validate before calling
org.flowable.task.api.Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
if (t != null && t.getProcessInstanceId() != null) {
processTaskService.complete(taskId); // owned by BPMN engine
} else {
cmmnTaskService.completeTask(taskId);
} Prevention
- Build a task dispatcher that routes completion to the engine that created the task.
- Include the originating engine in your task DTO when aggregating tasks from both engines.
When it happens
Trigger: Calling CmmnTaskService.completeTask(taskId) on a task whose TaskEntity.getProcessInstanceId() is set, i.e. a task created by a BPMN process (user task in a process definition) instead of a case plan item.
Common situations: Mixing engines: application looks up all tasks generically (e.g. taskService.createTaskQuery()) and completes them via the wrong engine's API; a shared task service where process and case tasks live side by side.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- is created by the process engine and should be completed vi
- The ${task} cannot be deleted because is part of a running c
- Setting variable is not supported for read only delegate exe
- Can only trigger a plan item that is in the ACTIVE state
- No External Worker job found for id: ${externalJobId}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c14f623b1d85e029.
Report an issue: GitHub.