flowable/flowable-engine · error · FlowableException

No task entity found for plan item instance <planItemInstanc

Error message

No task entity found for plan item instance <planItemInstanceId>

What it means

When moving a plan item instance of a HumanTask to AVAILABLE, Flowable deletes the underlying task entity; if no task entity is found for the plan item instance (sub-scope lookup by scope type CMMN returns nothing), this FlowableException is thrown because the engine's internal data is inconsistent.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/AbstractCmmnDynamicStateManager.java:456

                // all existing plan items are available, we can continue without any changes
                continue;
            }
            
            if (existingPlanItemInstance == null) {
                throw new FlowableException("No active or enabled plan item instances found for plan item definition " + planItemDefinitionMapping.getPlanItemDefinitionId());
            }
            
            PlanItemInstanceEntity existingPlanItemInstanceEntity = (PlanItemInstanceEntity) existingPlanItemInstance;

            if (!evaluateCondition(existingPlanItemInstanceEntity, planItemDefinitionMapping)) {
                continue;
            }

            if (existingPlanItemInstanceEntity.getPlanItem().getPlanItemDefinition() instanceof HumanTask) {
                TaskService taskService = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService();
                List<TaskEntity> taskEntities = taskService.findTasksBySubScopeIdScopeType(existingPlanItemInstanceEntity.getId(), ScopeTypes.CMMN);
                if (taskEntities == null || taskEntities.isEmpty()) {
                    throw new FlowableException("No task entity found for plan item instance " + existingPlanItemInstanceEntity.getId());
                }

                // Should be only one
                for (TaskEntity taskEntity : taskEntities) {
                    if (!taskEntity.isDeleted()) {
                        TaskHelper.deleteTask(taskEntity, "Change plan item state", false, false, cmmnEngineConfiguration);
                    }
                }
            }

            CmmnEngineAgenda agenda = CommandContextUtil.getAgenda(commandContext);
            agenda.planChangePlanItemInstanceToAvailableOperation(existingPlanItemInstanceEntity);
        }
    }
    
    protected void executeAddWaitingForRepetitionPlanItemInstances(CaseInstanceChangeState caseInstanceChangeState, 
            CaseInstanceEntity caseInstance, CommandContext commandContext) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the ACT_RU_TASK table for a row with the plan item instance id as SUB_SCOPE_ID_ and restore/repair consistency
  2. Delete or disable the orphaned plan item instance instead of moving it, then recreate the task flow
  3. Check for external processes/integrations that delete tasks outside the engine API
  4. Restore from a consistent backup or re-deploy/restart the case instance if data corruption is confirmed

Example fix

// before
cmmnRuntimeService.changePlanItemState(caseInstanceId, changeState); // throws: task row missing
// after
long tasks = taskService.createTaskQuery().subScopeId(planItemInstanceId).count();
if (tasks == 0) {
    // repair: disable the orphaned plan item instead of moving it
cmmnRuntimeService.changePlanItemState(caseInstanceId, changeState);
Defensive patterns

Strategy: validation

Validate before calling

Task task = taskService.createTaskQuery()
    .subScopeId(planItemInstanceId).caseInstanceId(caseInstanceId).singleResult();
if (task == null) throw new IllegalStateException("Missing task for plan item instance " + planItemInstanceId);

Try / catch

try {
    cmmnRuntimeService.changePlanItemState(caseInstanceId, changeState);
} catch (FlowableException e) {
    if (e.getMessage().startsWith("No task entity found")) {
        // repair data or disable plan item instead of moving
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: changePlanItemState moving an ACTIVE HumanTask plan item instance where the corresponding task row is missing from the task tables (deleted externally, incomplete data, or task never created due to prior engine errors).

Common situations: Database manipulated manually or by external jobs deleting tasks; upgrading between Flowable versions with leftover inconsistent data; a previous failed transaction left the plan item ACTIVE without its task.

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


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