flowable/flowable-engine · error · FlowableException

No active or enabled plan item instances found for plan item

Error message

No active or enabled plan item instances found for plan item definition <planItemDefinitionId>

What it means

When changing plan item instances to the AVAILABLE state, Flowable requires the current instance it is about to move to be ACTIVE or ENABLED. If none of the existing instances for the given plan item definition are active/enabled (i.e. no instance to move from), this FlowableException is thrown.

Source

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

                if (PlanItemInstanceState.ACTIVE.equals(planItemInstance.getState()) || PlanItemInstanceState.ENABLED.equals(planItemInstance.getState())) {
                    if (existingPlanItemInstance != null) {
                        throw new FlowableException("multiple active or enabled plan item instances found for plan item definition " + planItemDefinitionMapping.getPlanItemDefinitionId());
                    } else {
                        existingPlanItemInstance = planItemInstance;
                    }
                }
                if (!PlanItemInstanceState.AVAILABLE.equals(planItemInstance.getState())) {
                    allExistingPlanItemsAreAvailable = false;
                }
            }

            if (allExistingPlanItemsAreAvailable) {
                // 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()) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the plan item instance exists and is in ACTIVE or ENABLED state via PlanItemInstanceQuery before changing state
  2. Complete or trigger the plan item so it reaches ACTIVE state first, then move it
  3. Check the case instance id and case definition version are correct
  4. Use mapIncompleteChildrenForPlanItemDefinition or a state change that supports non-active source states

Example fix

// before
cmmnRuntimeService.changePlanItemState(caseInstanceId, changeState); // throws if not active
// after
PlanItemInstance pis = cmmnRuntimeService.createPlanItemInstanceQuery()
    .caseInstanceId(caseInstanceId).planItemDefinitionId("taskDef")
    .state(PlanItemInstanceState.ACTIVE).singleResult();
if (pis != null) {
    cmmnRuntimeService.changePlanItemState(caseInstanceId, changeState);
}
Defensive patterns

Strategy: validation

Validate before calling

PlanItemInstance pis = cmmnRuntimeService.createPlanItemInstanceQuery()
    .caseInstanceId(caseInstanceId).planItemDefinitionId(defId)
    .state(PlanItemInstanceState.ACTIVE).singleResult();
if (pis == null) throw new IllegalStateException("No ACTIVE instance of " + defId + " to move");

Try / catch

try {
    cmmnRuntimeService.changePlanItemState(caseInstanceId, changeState);
} catch (FlowableException e) {
    if (e.getMessage().startsWith("No active or enabled plan item instances")) {
        // skip or trigger the plan item first
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling changePlanItemState with a planItemDefinitionMapping whose plan item definition has no plan item instance in ACTIVE or ENABLED state in the case instance (all are AVAILABLE, COMPLETED, unavailable, or simply do not exist).

Common situations: Attempting to move a plan item that has not yet been created/triggered in the case; the case has already progressed past the plan item; wrong case instance id so no matching instances exist; plan item id typo so the lookup matches nothing.

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/e36197e0210ce232. Report an issue: GitHub.