{"record":{"id":"72be3147131cd1ae","repo":"flowable/flowable-engine","slug":"error-while-sending-signal-for-eventsubscription","errorCode":null,"errorMessage":"Error while sending signal for ${eventSubscriptionEntity} no activity associated with event subscription","messagePattern":"Error while sending signal for (.+?) no activity associated with event subscription","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/EventSubscriptionUtil.java","lineNumber":101,"sourceCode":"\n    protected static void scheduleEventAsync(EventSubscriptionEntity eventSubscriptionEntity, Object payload) {\n        CommandContext commandContext = CommandContextUtil.getCommandContext();\n        JobService jobService = CommandContextUtil.getJobService(commandContext);\n        JobEntity message = jobService.createJob();\n        message.setJobType(JobEntity.JOB_TYPE_MESSAGE);\n        message.setJobHandlerType(ProcessEventJobHandler.TYPE);\n        message.setElementId(eventSubscriptionEntity.getActivityId());\n        message.setJobHandlerConfiguration(eventSubscriptionEntity.getId());\n        message.setTenantId(eventSubscriptionEntity.getTenantId());\n        \n        String executionId = eventSubscriptionEntity.getExecutionId();\n        \n        if (StringUtils.isNotEmpty(executionId)) {\n            ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);\n            FlowNode currentFlowElement = (FlowNode) execution.getCurrentFlowElement();\n    \n            if (currentFlowElement == null) {\n                throw new FlowableException(\"Error while sending signal for \" + eventSubscriptionEntity + \" no activity associated with event subscription\");\n            }\n            \n            EventSubscriptionUtil.processPayloadMap(payload, execution, currentFlowElement, commandContext);\n        }\n\n        jobService.scheduleAsyncJob(message);\n    }\n}\n","sourceCodeStart":83,"sourceCodeEnd":110,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/EventSubscriptionUtil.java#L83-L110","documentation":"When an event subscription is processed asynchronously, scheduleEventAsync looks up the execution by the subscription's executionId and reads its currentFlowElement to signal the waiting activity. If the execution exists but has no current FlowElement set, Flowable cannot know which activity to signal and throws this FlowableException before scheduling the async job.","triggerScenarios":"scheduleEventAsync is invoked (via eventReceived) for a subscription whose executionId resolves to an ExecutionEntity whose getCurrentFlowElement() is null — i.e. the execution is not currently parked on a flow element such as an intermediate catch event or receive task.","commonSituations":"Signalling an execution that already moved past the catching activity (duplicate signal); concurrent modification of the execution leaving it between elements; asynchronous continuation or transaction boundaries causing the execution's flow element to be unset when the event job runs; deleting/redeploying a process while executions wait on events.","solutions":["Ensure the execution is actually waiting at the event-catching activity before the event is delivered; guard signal calls against double delivery.","Check for concurrent updates to the execution (use optimistic locking / proper transaction scope) so currentFlowElement is never null when the event job executes.","Redeploy or repair the affected process instance if the execution state is corrupt; inspect ACT_RU_EXECUTION rows for the instance.","If the wait state uses async continuation, verify the flow element is set before the async job is scheduled."],"exampleFix":"// before: signalling blindly, possibly twice\nruntimeService.signal(executionId);\nruntimeService.signal(executionId);\n\n// after: guard against duplicate signalling\nif (runtimeService.createExecutionQuery().executionId(executionId).singleResult() != null) {\n    runtimeService.signal(executionId);\n}","handlingStrategy":"try-catch","validationCode":"// check the execution is waiting before signalling\nExecution exec = runtimeService.createExecutionQuery()\n    .executionId(executionId).singleResult();\nboolean waiting = exec != null && exec.getActivityId() != null;","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.signal(executionId);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"no activity associated\")) {\n        log.warn(\"Execution {} no longer waiting on event; ignoring duplicate signal\", executionId);\n    } else { throw e; }\n}","preventionTips":["Guard against duplicate signal deliveries (idempotency keys or existence checks)","Avoid manual manipulation of execution state in DB","Keep async continuations and event delivery in the same transactional design review"],"tags":["event-subscription","execution-state","async"],"backgroundTag":"invalid-state-transition","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"}