{"record":{"id":"19ae676fcfbacd09","repo":"flowable/flowable-engine","slug":"exception-while-sending-signal-for-event-subscript","errorCode":null,"errorMessage":"exception while sending signal for event subscription '${eventSubscription}':${e.getMessage()}","messagePattern":"exception while sending signal for event subscription '(.+?)':(.+?)","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/event/AbstractEventHandler.java","lineNumber":65,"sourceCode":"            @SuppressWarnings(\"unchecked\")\r\n            Map<String, Object> processVariables = (Map<String, Object>) payload;\r\n            execution.setVariables(processVariables);\r\n        }\r\n\r\n        ActivityBehavior activityBehavior = activity.getActivityBehavior();\r\n        if (activityBehavior instanceof BoundaryEventActivityBehavior\r\n                || activityBehavior instanceof EventSubProcessStartEventActivityBehavior) {\r\n\r\n            try {\r\n\r\n                dispatchActivitiesCanceledIfNeeded(eventSubscription, execution, activity, commandContext);\r\n\r\n                activityBehavior.execute(execution);\r\n\r\n            } catch (RuntimeException e) {\r\n                throw e;\r\n            } catch (Exception e) {\r\n                throw new ActivitiException(\"exception while sending signal for event subscription '\" + eventSubscription + \"':\" + e.getMessage(), e);\r\n            }\r\n\r\n        } else { // not boundary\r\n            if (!activity.equals(execution.getActivity())) {\r\n                execution.setActivity(activity);\r\n            }\r\n            execution.signal(eventSubscription.getEventName(), payload);\r\n        }\r\n    }\r\n\r\n    protected void dispatchActivitiesCanceledIfNeeded(EventSubscriptionEntity eventSubscription, ExecutionEntity execution, ActivityImpl boundaryEventActivity, CommandContext commandContext) {\r\n        ActivityBehavior boundaryActivityBehavior = boundaryEventActivity.getActivityBehavior();\r\n        if (boundaryActivityBehavior instanceof BoundaryEventActivityBehavior) {\r\n            BoundaryEventActivityBehavior boundaryEventActivityBehavior = (BoundaryEventActivityBehavior) boundaryActivityBehavior;\r\n            if (boundaryEventActivityBehavior.isInterrupting()) {\r\n                dispatchExecutionCancelled(eventSubscription, execution, commandContext);\r\n            }\r\n        }\r","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/event/AbstractEventHandler.java#L47-L83","documentation":"During event-subscription handling, the target activity's behavior is executed. If that behavior throws a checked Exception, AbstractEventHandler wraps it in an ActivitiException that includes the subscription and the original message; RuntimeExceptions are rethrown as-is.","triggerScenarios":"handleEvent executing an ActivityBehavior that throws a checked Exception — e.g. a JavaDelegate/behavior failing during signal delivery of a message/signal event.","commonSituations":"Custom delegates throwing checked exceptions on event trigger; I/O or transactional failures inside behavior code executed by signal; nested cause chain hidden in the wrapped ActivitiException.","solutions":["Inspect the wrapped cause (e.getCause()) to find the real failure","Fix the underlying behavior/delegate to not throw checked exceptions or handle them internally","Declare the behavior code to throw only RuntimeExceptions, which Flowable propagates unchanged"],"exampleFix":"// before\nclass MyDelegate implements JavaDelegate {\n    public void execute(DelegateExecution e) throws Exception { doWork(); }\n}\n// after\nclass MyDelegate implements JavaDelegate {\n    public void execute(DelegateExecution e) {\n        try { doWork(); } catch (Exception ex) { throw new RuntimeException(ex); }\n    }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.signalEventReceived(signalName, executionId);\n} catch (ActivitiException e) {\n    Throwable cause = e.getCause();\n    // handle the underlying behavior failure (cause.getMessage())\n}","preventionTips":["Always inspect getCause() on this ActivitiException — the root failure is nested","Throw RuntimeExceptions from delegates/behaviors so they propagate unwrapped","Test event-triggered delegates with real signals before deployment"],"tags":["event-subscription","delegate","wrapped-exception"],"backgroundTag":"upstream-api-error","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"}