{"record":{"id":"1b84beb558709bbd","repo":"flowable/flowable-engine","slug":"unexpected-activity-behavior-behavior-getclas","errorCode":null,"errorMessage":"Unexpected activity behavior (\" + behavior.getClass() + \") found for \" + job + \" at \" + executionEntity","messagePattern":"Unexpected activity behavior \\(\" \\+ behavior\\.getClass\\(\\) \\+ \"\\) found for \" \\+ job \\+ \" at \" \\+ executionEntity","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java","lineNumber":49,"sourceCode":"    public static final String TYPE = \"async-send-event\";\n\n    @Override\n    public String getType() {\n        return TYPE;\n    }\n\n    @Override\n    public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {\n        ExecutionEntity executionEntity = (ExecutionEntity) variableScope;\n        FlowElement flowElement = executionEntity.getCurrentFlowElement();\n\n        if (!(flowElement instanceof SendEventServiceTask)) {\n            throw new FlowableException(\"Unexpected activity type found for \" + job + \" at \" + executionEntity);\n        }\n\n        Object behavior = ((SendEventServiceTask) flowElement).getBehavior();\n        if (!(behavior instanceof ActivityBehavior activityBehavior)) {\n            throw new FlowableException(\n                    \"Unexpected activity behavior (\" + behavior.getClass() + \") found for \" + job + \" at \" + executionEntity);\n        }\n\n        try {\n            commandContext.addAttribute(TYPE, true); // Will be read in the SendEventTaskActivityBehavior\n            activityBehavior.execute(executionEntity);\n        } finally {\n            commandContext.removeAttribute(TYPE);\n        }\n    }\n\n}\n","sourceCodeStart":31,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/jobexecutor/AsyncSendEventJobHandler.java#L31-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom BPMN parse handlers overriding SendEvent behavior, engine/model version skew, or corrupted deployment metadata after an upgrade.","solutions":["Check custom BpmnParseHandler implementations for code that replaces SendEventServiceTask behavior","Ensure the same Flowable version parses and executes the model (no mixed-version cluster)","Redeploy the process definition so the behavior is regenerated correctly"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* job execution */ } catch (FlowableException e) { if (e.getMessage().contains(\"Unexpected activity behavior\")) { /* inspect custom parse handlers, redeploy definition */ } else throw e; }","preventionTips":["Audit custom BpmnParseHandlers that override built-in task behaviors","Run a homogeneous Flowable version across the cluster"],"tags":["flowable","job-executor","async","behavior"],"backgroundTag":"internal-invariant-violation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}