flowable/flowable-engine · error · FlowableIllegalStateException

Cannot trigger case task plan item instance : no reference i

Error message

Cannot trigger case task plan item instance : no reference id set

What it means

When triggering a case task plan item, the behavior checks that the instance's referenceId points at the child case instance started for it. If referenceId is null, the engine has no child-case linkage to complete and throws this error. The reference is set when the case task starts the child case.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/CaseTaskActivityBehavior.java:169

        if (variablesFromFormSubmission != null && !variablesFromFormSubmission.isEmpty()) {
            // The variablesFromFormSubmission can only be non null if there was formInfo
            cmmnEngineConfiguration.getFormFieldHandler()
                    .handleFormFieldsOnSubmit(variableInfo.formInfo, null, null, caseInstanceEntity.getId(), ScopeTypes.CMMN,
                            variablesFromFormSubmission, caseInstanceEntity.getTenantId());
        }

        if (!blocking) {
            CommandContextUtil.getAgenda(commandContext).planCompletePlanItemInstanceOperation(planItemInstanceEntity);
        }
    }

    @Override
    public void trigger(CommandContext commandContext, PlanItemInstanceEntity planItemInstance) {
        if (!PlanItemInstanceState.ACTIVE.equals(planItemInstance.getState())) {
            throw new FlowableIllegalStateException("Can only trigger a plan item that is in the ACTIVE state");
        }
        if (planItemInstance.getReferenceId() == null) {
            throw new FlowableIllegalStateException("Cannot trigger case task plan item instance : no reference id set");
        }
        if (!ReferenceTypes.PLAN_ITEM_CHILD_CASE.equals(planItemInstance.getReferenceType())) {
            throw new FlowableIllegalStateException("Cannot trigger case task plan item instance : reference type '"
                    + planItemInstance.getReferenceType() + "' not supported");
        }

        // load the case instance referenced by this case task plan item to check its current state
        CaseInstanceEntity caseInstance = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(planItemInstance.getReferenceId());

        if (caseInstance != null) {
            // Out parameters are handled here only when the case is still active (manual trigger scenario).
            // When the child case completed normally, out parameters are already handled
            // in ChildCaseInstanceStateChangeCallback before the child case gets deleted.
            handleOutParameters(commandContext, planItemInstance);

            if (caseInstance.getState().equals(CaseInstanceState.ACTIVE)) {
                // Triggering the plan item (as opposed to a regular complete of the referenced case) manually terminates the case instance
                CommandContextUtil.getAgenda(commandContext).planManualTerminateCaseInstanceOperation(planItemInstance.getReferenceId());

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Only trigger blocking case task plan items that actually started a child case (referenceType PLAN_ITEM_CHILD_CASE).
  2. Verify the child case instance exists (CaseInstanceQuery by parent/plan item) before completing.
  3. If the child case failed to start, fix the underlying error and let the case task be completed through the normal completion path.
  4. Do not manually complete non-blocking case tasks; they complete automatically.

Example fix

// before
runtimeService.triggerPlanItemInstance(nonBlockingCaseTaskPiiId); // referenceId == null
// after
PlanItemInstance pii = runtimeService.createPlanItemInstanceQuery()
    .planItemInstanceId(id).singleResult();
if (pii.getReferenceId() != null) {
    runtimeService.triggerPlanItemInstance(id);
}
Defensive patterns

Strategy: validation

Validate before calling

PlanItemInstance pii = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceId(id).singleResult();
boolean triggerable = pii != null && pii.getReferenceId() != null;

Try / catch

try {
    cmmnRuntimeService.triggerPlanItemInstance(id);
} catch (FlowableIllegalStateException e) {
    if (e.getMessage().contains("no reference id set")) {
        // plan item never started a child case; do not complete manually
    }
}

Prevention

When it happens

Trigger: Calling trigger on a case task plan item instance that never started a child case — e.g. the task was made non-blocking (completed immediately), the child case failed to start, or the plan item was created without executing the child-case start logic.

Common situations: Manually triggering a non-blocking case task; engine crash/rollback after plan item activation but before child case creation; tampering with instance data; version mismatch between parent case runtime data and engine code.

Related errors


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