flowable/flowable-engine · critical · FlowableException

Could not find plan item instance for

Error message

Could not find plan item instance for 

What it means

Thrown by CompleteTaskWithFormCmd.completeTask when the task's subScopeId does not resolve to an existing plan item instance. Identical root cause as CompleteTaskCmd's variant: the CMMN plan item backing the task is gone (case terminated/deleted concurrently or data manipulated outside the engine), so form-based completion cannot continue.

Solutions

  1. Confirm the case instance is still active and the plan item instance exists before completing the task with a form.
  2. Never delete CMMN runtime rows manually; terminate cases via the engine API.
  3. Handle the resulting FlowableException in the UI (task no longer completable) and refresh the task list.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    cmmnTaskService.completeTaskWithForm(taskId, formId, outcome, vars);
} catch (FlowableException e) {
    if (e.getMessage() != null && e.getMessage().contains("Could not find plan item instance")) {
        log.warn("Underlying plan item gone for task {}", taskId);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling completeTaskWithForm on a case task whose planItemInstanceEntityManager.findById(subScopeId) returns null after concurrent case termination, external table cleanup, or inconsistent backups.

Common situations: Task inbox race conditions with case termination; manual SQL maintenance on ACT_CMMN_RU_PLAN_ITEM_INST; partially restored databases.

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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java:182

        return null;
    }

    protected boolean isFormFieldValidationEnabled(TaskEntity task) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration();
        if (cmmnEngineConfiguration.isFormFieldValidationEnabled() && CaseDefinitionUtil.getCmmnModel(task.getScopeDefinitionId()).
                findPlanItemDefinition(task.getTaskDefinitionKey()) instanceof HasValidateFormFields hasValidateFormFields) {
            String formFieldValidationExpression = hasValidateFormFields.getValidateFormFields();
            return TaskHelper.isFormFieldValidationEnabled(task, cmmnEngineConfiguration, formFieldValidationExpression);
        }
        return false;
    }

    protected void completeTask(CommandContext commandContext, TaskEntity task, Map<String, Object> taskVariables) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        String planItemInstanceId = task.getSubScopeId();
        PlanItemInstanceEntity planItemInstanceEntity = cmmnEngineConfiguration.getPlanItemInstanceEntityManager().findById(planItemInstanceId);
        if (planItemInstanceEntity == null) {
            throw new FlowableException("Could not find plan item instance for " + task);
        }

        if (taskVariables != null) {
            if (localScope) { // backwards compatibility from before variableLocal was available in constructor
                task.setVariablesLocal(taskVariables);
            } else {
                task.setVariables(taskVariables);
            }
        }

        if (variablesLocal != null) {
            task.setVariablesLocal(variablesLocal);
        }

        if (transientVariables != null) {
            if (localScope) { // backwards compatibility from before variableLocal was available in constructor
                task.setTransientVariablesLocal(transientVariables);
            } else {

View on GitHub (pinned to d6d39ce1c6)