flowable/flowable-engine · error · FlowableException
No task entity found for
Error message
No task entity found for
What it means
After confirming the plan item is ACTIVE, trigger() looks up the underlying TaskEntity by the plan item's id as subScopeId. If no task rows are found — an internal consistency violation — Flowable throws FlowableException with the plan item instance's toString, because a task-backed human plan item must always have a corresponding task.
Solutions
- Never delete runtime tasks directly with taskService.deleteTask; complete them via TaskService.completeTask or let the CMMN engine handle exit/termination.
- Verify ACT_RU_TASK rows for the plan item id (query: select * from ACT_RU_TASK where SUB_SCOPE_ID_ = '<planItemInstanceId>').
- If data was corrupted, recreate or re-trigger the case via a new case instance rather than patching rows.
- Catch FlowableException in trigger flows and log planItemInstance.getId() to investigate missing task data.
Example fix
// before taskService.deleteTask(taskId); // removes ACT_RU_TASK row, CMMN trigger later fails // after taskService.completeTask(taskId);
Defensive patterns
Strategy: validation
Validate before calling
List<Task> tasks = taskService.createTaskQuery()
.subScopeId(planItemInstanceId).list();
if (tasks.isEmpty()) throw new IllegalStateException("No runtime task for plan item " + planItemInstanceId + "; data may be corrupted"); Type guard
null
Try / catch
try {
runtimeService.triggerPlanItemInstance(id);
} catch (FlowableException e) {
if (e.getMessage().startsWith("No task entity found for")) {
log.error("Missing ACT_RU_TASK row for plan item {} - check for direct task deletions", id);
}
} Prevention
- Never delete runtime tasks directly with taskService.deleteTask
- Let the CMMN engine terminate/exit plan items so tasks are removed through TaskHelper
- Audit DB maintenance/migration scripts that touch ACT_RU_TASK
- Monitor for orphaned ACTIVE plan items without tasks
When it happens
Trigger: trigger() on an ACTIVE human task plan item where findTasksBySubScopeIdScopeType(planItemInstance.getId(), CMMN) returns null or an empty list — e.g. the task was deleted directly via TaskService/outside the engine, data was manipulated in the DB, or task creation was skipped/failed earlier.
Common situations: Tasks deleted with taskService.deleteTask bypassing task completion logic; database cleanup/migration scripts removing ACT_RU_TASK rows; manually activating plan items whose task creation failed; restoring CMMN data from backups inconsistently.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Could not find plan item instance for
- Could not find plan item instance for
- Unknown variable type
- A dynamically created plan item can only be injected into a…
- A dynamically created plan item can only be injected into a…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/993918fc08259d86.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java:476
Expression expression = expressionManager.createExpression(humanTask.getTaskIdVariableName());
String idVariableName = (String) expression.getValue(planItemInstanceEntity);
if (StringUtils.isNotEmpty(idVariableName)) {
planItemInstanceEntity.setVariable(idVariableName, taskEntity.getId());
}
}
}
@Override
public void trigger(CommandContext commandContext, PlanItemInstanceEntity planItemInstance) {
if (!PlanItemInstanceState.ACTIVE.equals(planItemInstance.getState())) {
throw new FlowableIllegalStateException("Can only trigger a human task plan item that is in the ACTIVE state");
}
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
TaskService taskService = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService();
List<TaskEntity> taskEntities = taskService.findTasksBySubScopeIdScopeType(planItemInstance.getId(), ScopeTypes.CMMN);
if (taskEntities == null || taskEntities.isEmpty()) {
throw new FlowableException("No task entity found for " + planItemInstance);
}
// Should be only one
for (TaskEntity taskEntity : taskEntities) {
if (!taskEntity.isDeleted()) {
TaskHelper.completeTask(taskEntity, taskEntity.getTempCompletedBy(), cmmnEngineConfiguration);
}
}
CommandContextUtil.getAgenda(commandContext).planCompletePlanItemInstanceOperation(planItemInstance);
}
@Override
public void onStateTransition(CommandContext commandContext, DelegatePlanItemInstance planItemInstance, String transition) {
if (PlanItemTransition.TERMINATE.equals(transition) || PlanItemTransition.EXIT.equals(transition)) {
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
TaskService taskService = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService();
List<TaskEntity> taskEntities = taskService.findTasksBySubScopeIdScopeType(planItemInstance.getId(), ScopeTypes.CMMN);View on GitHub (pinned to d6d39ce1c6)