flowable/flowable-engine · error · FlowableException

Cannot trigger a plan item which activity behavior does not

Error message

Cannot trigger a plan item which activity behavior does not implement the ${behaviorClass} interface in ${planItemInstanceEntity}

What it means

executeTrigger() casts the plan item's behavior to CmmnTriggerableActivityBehavior before delegating the trigger. If the behavior object attached to the plan item does not implement that interface, it cannot be triggered and Flowable throws this error. This is an internal wiring invariant of the plan item's activity behavior.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/TriggerPlanItemInstanceOperation.java:56

                && planItemInstanceEntity.getPlanItem().getPlanItemDefinition() instanceof EventListener
                && PlanItemInstanceState.AVAILABLE.equals(planItemInstanceEntity.getState()))){
            
            executeTrigger();

        } else {
            if (planItemInstanceEntity.getPlanItem() != null && planItemInstanceEntity.getPlanItem().getPlanItemDefinition() instanceof EventListener){
                throw new FlowableIllegalStateException("Can only trigger an event listener plan item that is in the AVAILABLE state");
            } else {
                throw new FlowableIllegalStateException("Can only trigger a plan item that is in the ACTIVE state");
            }

        }
    }

    protected void executeTrigger() {
        Object behaviorObject = planItemInstanceEntity.getPlanItem().getBehavior();
        if (!(behaviorObject instanceof CmmnTriggerableActivityBehavior)) {
            throw new FlowableException("Cannot trigger a plan item which activity behavior does not implement the " 
                    + CmmnTriggerableActivityBehavior.class + " interface in " + planItemInstanceEntity);
        }
        CmmnTriggerableActivityBehavior behavior = (CmmnTriggerableActivityBehavior) planItemInstanceEntity.getPlanItem().getBehavior();
        if (behavior instanceof CoreCmmnTriggerableActivityBehavior) {
            ((CoreCmmnTriggerableActivityBehavior) behavior).trigger(commandContext, planItemInstanceEntity);
        } else {
            behavior.trigger(planItemInstanceEntity);
        }
    }
    
    @Override
    public String toString() {
        PlanItem planItem = planItemInstanceEntity.getPlanItem();
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("[Trigger PlanItem] ");
        stringBuilder.append(planItem);
        return stringBuilder.toString();
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Make the custom activity behavior implement CmmnTriggerableActivityBehavior (and CoreCmmnTriggerableActivityBehavior if it needs the commandContext).
  2. Verify the PlanItemHandler/behavior registration in the CmmnEngineConfiguration maps the definition type to the correct triggerable behavior class.
  3. Check the plan item definition in the CMMN XML: only definition types with triggerable behaviors can be programmatically triggered.
  4. Redeploy the case definition after fixing the model/behavior.

Example fix

// before
public class MyBehavior implements CmmnActivityBehavior {
    public void execute(PlanItemInstanceEntity e) { ... }
}
// after
public class MyBehavior implements CoreCmmnTriggerableActivityBehavior {
    public void execute(PlanItemInstanceEntity e) { ... }
    public void trigger(CommandContext ctx, PlanItemInstanceEntity e) { ... }
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Register only behaviors implementing CmmnTriggerableActivityBehavior in your PlanItemHandler
boolean triggerable = CmmnTriggerableActivityBehavior.class
    .isInstance(planItem.getBehavior());

Type guard

if (behavior instanceof CmmnTriggerableActivityBehavior) {
    ((CmmnTriggerableActivityBehavior) behavior).trigger(...);
}

Try / catch

try {
    cmmnRuntimeService.triggerPlanItemInstance(id);
} catch (FlowableException e) {
    // behavior wiring bug — fix the PlanItemHandler registration
}

Prevention

When it happens

Trigger: Triggering a plan item whose configured behavior (from its PlanItemDefinition / custom PlanItemHandler) is a non-triggerable CmmnActivityBehavior, e.g. a custom behavior registered via CmmnEngineConfiguration that implements only the non-triggerable interface.

Common situations: Custom PlanItemHandler returning a behavior that implements CmmnActivityBehavior but not CmmnTriggerableActivityBehavior; engine upgrades where behavior class hierarchies changed; misconfiguration of a plan item definition in the case model.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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