{"record":{"id":"905aab1ede7d56c6","repo":"flowable/flowable-engine","slug":"execution-with-id-executionid-does-not-h","errorCode":null,"errorMessage":"Execution with id '\" + executionId + \"' does not have a subscription to a message event with name '\" + messageName + \"'","messagePattern":"Execution with id '\" \\+ executionId \\+ \"' does not have a subscription to a message event with name '\" \\+ messageName \\+ \"'","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/MessageEventReceivedCmd.java","lineNumber":74,"sourceCode":"\r\n    public MessageEventReceivedCmd(String messageName, String executionId, boolean async) {\r\n        super(executionId);\r\n        this.messageName = messageName;\r\n        this.payload = null;\r\n        this.async = async;\r\n    }\r\n\r\n    @Override\r\n    protected Void execute(CommandContext commandContext, ExecutionEntity execution) {\r\n        if (messageName == null) {\r\n            throw new ActivitiIllegalArgumentException(\"messageName cannot be null\");\r\n        }\r\n\r\n        List<EventSubscriptionEntity> eventSubscriptions = commandContext.getEventSubscriptionEntityManager()\r\n                .findEventSubscriptionsByNameAndExecution(MessageEventHandler.EVENT_HANDLER_TYPE, messageName, executionId);\r\n\r\n        if (eventSubscriptions.isEmpty()) {\r\n            throw new ActivitiException(\"Execution with id '\" + executionId + \"' does not have a subscription to a message event with name '\" + messageName + \"'\");\r\n        }\r\n\r\n        // there can be only one:\r\n        EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions.get(0);\r\n\r\n        eventSubscriptionEntity.eventReceived(payload, async);\r\n\r\n        return null;\r\n    }\r\n\r\n}\r\n","sourceCodeStart":56,"sourceCodeEnd":86,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/MessageEventReceivedCmd.java#L56-L86","documentation":"Thrown by MessageEventReceivedCmd.execute() when no message event subscription with the given messageName exists on the given execution. The engine queries event subscriptions by name+execution; an empty result means the execution is not waiting for that message, so delivery is impossible and ActivitiException is raised.","triggerScenarios":"runtimeService.messageEventReceived(name, executionId) where the execution has no active message boundary/intermediate catch event with that name; wrong execution id (e.g. passing process instance id instead of the waiting execution id); message already consumed or event fired before delivery.","commonSituations":"Correlation code using processInstanceId instead of the execution id of the scope waiting for the message; race between two triggers; process advanced past the catch event before delivery; message name mismatch with the BPMN messageRef.","solutions":["Use the execution id of the execution waiting in the message catch event (query createExecutionQuery().messageEventSubscriptionName(name))","Verify the messageName exactly matches the BPMN messageRef/catch event name","Use executionEntity.eventReceived semantics via runtimeService.trigger or an execution query to find valid targets","Handle the race: catch ActivitiException and re-query before retrying delivery"],"exampleFix":"// before\nruntimeService.messageEventReceived(\"orderMsg\", processInstanceId);\n// after\nExecution e = runtimeService.createExecutionQuery()\n    .messageEventSubscriptionName(\"orderMsg\")\n    .processInstanceId(processInstanceId).singleResult();\nif (e != null) runtimeService.messageEventReceived(\"orderMsg\", e.getId());","handlingStrategy":"validation","validationCode":"Execution e = runtimeService.createExecutionQuery().messageEventSubscriptionName(messageName).executionId(executionId).singleResult();\nif (e == null) throw new IllegalStateException(\"no subscription for \" + messageName);","typeGuard":null,"tryCatchPattern":"try { runtimeService.messageEventReceived(messageName, executionId, payload); } catch (ActivitiException e) { if (e.getMessage().contains(\"does not have a subscription\")) { log.warn(\"message not awaited; process may have moved on\"); return; } throw e; }","preventionTips":["Always resolve the waiting execution id via an execution query, not the process instance id","Design idempotent correlation (message start/intermediate catch) to survive duplicate triggers","Verify the process has not already passed the catch event before delivering"],"tags":["java","activiti","message-event","correlation","not-found"],"backgroundTag":"entity-not-found","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"}