flowable/flowable-engine · error · FlowableException

Unexpected activity behavior (" + behavior.getClass() + ")…

Error message

Unexpected activity behavior (" + behavior.getClass() + ") found for " + job + " at " + executionEntity

What it means

Thrown by AsyncSendEventJobHandler.execute when the SendEventServiceTask's behavior is not an ActivityBehavior. The handler casts the behavior to ActivityBehavior to execute it; a different behavior implementation indicates a corrupted or incompatible BPMN model.

Solutions

  1. Check custom BpmnParseHandler implementations for code that replaces SendEventServiceTask behavior
  2. Ensure the same Flowable version parses and executes the model (no mixed-version cluster)
  3. Redeploy the process definition so the behavior is regenerated correctly
Defensive patterns

Strategy: try-catch

Try / catch

try { /* job execution */ } catch (FlowableException e) { if (e.getMessage().contains("Unexpected activity behavior")) { /* inspect custom parse handlers, redeploy definition */ } else throw e; }

Prevention

When it happens

Trigger: Async send-event job running where the flow element's parsed behavior class is not an ActivityBehavior — e.g. model parsed by an incompatible Flowable version or custom BpmnParseHandler replaced the behavior.

Common situations: Custom BPMN parse handlers overriding SendEvent behavior, engine/model version skew, or corrupted deployment metadata after an upgrade.

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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java:49

    public static final String TYPE = "async-send-event";

    @Override
    public String getType() {
        return TYPE;
    }

    @Override
    public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
        ExecutionEntity executionEntity = (ExecutionEntity) variableScope;
        FlowElement flowElement = executionEntity.getCurrentFlowElement();

        if (!(flowElement instanceof SendEventServiceTask)) {
            throw new FlowableException("Unexpected activity type found for " + job + " at " + executionEntity);
        }

        Object behavior = ((SendEventServiceTask) flowElement).getBehavior();
        if (!(behavior instanceof ActivityBehavior activityBehavior)) {
            throw new FlowableException(
                    "Unexpected activity behavior (" + behavior.getClass() + ") found for " + job + " at " + executionEntity);
        }

        try {
            commandContext.addAttribute(TYPE, true); // Will be read in the SendEventTaskActivityBehavior
            activityBehavior.execute(executionEntity);
        } finally {
            commandContext.removeAttribute(TYPE);
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)