{"record":{"id":"3c1502ca90cacdff","repo":"flowable/flowable-engine","slug":"no-behavior-specified-in-activity","errorCode":null,"errorMessage":"no behavior specified in ${activity}","messagePattern":"no behavior specified in (.+?)","errorType":"exception","errorClass":"PvmException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/pvm/runtime/AtomicOperationActivityExecute.java","lineNumber":46,"sourceCode":"/**\n * @author Tom Baeyens\n */\npublic class AtomicOperationActivityExecute implements AtomicOperation {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(AtomicOperationActivityExecute.class);\n\n    @Override\n    public boolean isAsync(InterpretableExecution execution) {\n        return false;\n    }\n\n    @Override\n    public void execute(InterpretableExecution execution) {\n        ActivityImpl activity = (ActivityImpl) execution.getActivity();\n\n        ActivityBehavior activityBehavior = activity.getActivityBehavior();\n        if (activityBehavior == null) {\n            throw new PvmException(\"no behavior specified in \" + activity);\n        }\n\n        LOGGER.debug(\"{} executes {}: {}\", execution, activity, activityBehavior.getClass().getName());\n\n        try {\n            if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {\n                Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(\n                        ActivitiEventBuilder.createActivityEvent(FlowableEngineEventType.ACTIVITY_STARTED,\n                                execution.getActivity().getId(),\n                                (String) execution.getActivity().getProperty(\"name\"),\n                                execution.getId(),\n                                execution.getProcessInstanceId(),\n                                execution.getProcessDefinitionId(),\n                                (String) activity.getProperties().get(\"type\"),\n                                activity.getActivityBehavior().getClass().getCanonicalName()),\n                        EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);\n            }\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/pvm/runtime/AtomicOperationActivityExecute.java#L28-L64","documentation":"PvmException thrown by AtomicOperationActivityExecute when the activity about to be executed has no ActivityBehavior set. Every activity the runtime actually executes must carry behavior (the code implementing what the activity does). An activity with no behavior cannot perform any work, so the engine fails fast.","triggerScenarios":"Reaching an activity during execution whose ActivityBehavior is null — e.g. a programmatically created ActivityImpl (new ActivityImpl(...)) that never got setActivityBehavior(...), or a model import that skipped behavior assignment.","commonSituations":"Hand-built PVM definitions used for tests/tools, custom BPMN parsers that forget to map an element type to its behavior, or manually modifying a deployed model.","solutions":["Call activity.setActivityBehavior(new SomeBehavior(...)) on the activity before it is executed.","For BPMN-parsed models, ensure the parser registers behaviors for all element types in the model.","Remove the empty activity from the model if it was not intended to execute."],"exampleFix":"// before\nActivityImpl act = scope.createActivity(\"manualTask\");\n// no behavior set -> runtime fails\n// after\nActivityImpl act = scope.createActivity(\"manualTask\");\nact.setActivityBehavior(new TaskDefinitionBehavior(taskDefinition));","handlingStrategy":"validation","validationCode":"ActivityBehavior b = activity.getActivityBehavior();\nif (b == null) {\n  throw new IllegalArgumentException(\"activity '\" + activity.getId() + \"' has no ActivityBehavior assigned\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  execution.executeActivity(activity);\n} catch (PvmException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"no behavior specified\")) {\n    log.error(\"Missing behavior on activity: \" + e.getMessage());\n  }\n  throw e;\n}","preventionTips":["After building activities programmatically, always call setActivityBehavior(...) on every executable activity.","Verify the BPMN parser maps every element type to a behavior during custom imports.","Assert behaviors in a post-build pass over all activities before runtime execution."],"tags":["java","pvm","activity-behavior","missing-implementation"],"backgroundTag":"missing-implementation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}