{"record":{"id":"6554abc6e403bc22","repo":"flowable/flowable-engine","slug":"cannot-deploy-process-definition-s-there-multi","errorCode":null,"errorMessage":"Cannot deploy process definition '%s': there multiple message event subscriptions for the message with name '%s'.","messagePattern":"Cannot deploy process definition '(.+?)': there multiple message event subscriptions for the message with name '(.+?)'\\.","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/BpmnDeployer.java","lineNumber":407,"sourceCode":"            }\n\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    protected void addMessageEventSubscriptions(ProcessDefinitionEntity processDefinition) {\n        CommandContext commandContext = Context.getCommandContext();\n        List<EventSubscriptionDeclaration> eventDefinitions = (List<EventSubscriptionDeclaration>) processDefinition.getProperty(BpmnParse.PROPERTYNAME_EVENT_SUBSCRIPTION_DECLARATION);\n        if (eventDefinitions != null) {\n\n            Set<String> messageNames = new HashSet<>();\n            for (EventSubscriptionDeclaration eventDefinition : eventDefinitions) {\n                if (\"message\".equals(eventDefinition.getEventType()) && eventDefinition.isStartEvent()) {\n\n                    if (!messageNames.contains(eventDefinition.getEventName())) {\n                        messageNames.add(eventDefinition.getEventName());\n                    } else {\n                        throw new ActivitiException(\"Cannot deploy process definition '\" + processDefinition.getResourceName()\n                                + \"': there multiple message event subscriptions for the message with name '\" + eventDefinition.getEventName() + \"'.\");\n                    }\n\n                    // look for subscriptions for the same name in db:\n                    List<EventSubscriptionEntity> subscriptionsForSameMessageName = commandContext.getEventSubscriptionEntityManager()\n                            .findEventSubscriptionsByName(MessageEventHandler.EVENT_HANDLER_TYPE,\n                                    eventDefinition.getEventName(), processDefinition.getTenantId());\n                    // also look for subscriptions created in the session:\n                    List<MessageEventSubscriptionEntity> cachedSubscriptions = commandContext\n                            .getDbSqlSession()\n                            .findInCache(MessageEventSubscriptionEntity.class);\n                    for (MessageEventSubscriptionEntity cachedSubscription : cachedSubscriptions) {\n                        if (eventDefinition.getEventName().equals(cachedSubscription.getEventName())\n                                && !subscriptionsForSameMessageName.contains(cachedSubscription)) {\n                            subscriptionsForSameMessageName.add(cachedSubscription);\n                        }\n                    }\n                    // remove subscriptions deleted in the same command","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/BpmnDeployer.java#L389-L425","documentation":"When deploying, every message start event in the process creates a message event subscription. If a single process definition declares multiple start events subscribed to the same message name, the deployment is rejected because subscriptions would be ambiguous.","triggerScenarios":"deploy -> addMessageEventSubscriptions when two or more message start events within one process definition (same resource) reference the same message name.","commonSituations":"Copy-pasting a message start event in the BPMN designer and forgetting to change the message name; merging process models that each used the same message name.","solutions":["Give each message start event a distinct message name (or distinct message element)","Remove the duplicate message start event","Use one start event with multiple conditional paths instead of multiple identical message starts"],"exampleFix":"<!-- before -->\n<message id=\"msgOrder\" name=\"orderMessage\"/>\n<startEvent id=\"s1\"><messageEventDefinition messageRef=\"msgOrder\"/></startEvent>\n<startEvent id=\"s2\"><messageEventDefinition messageRef=\"msgOrder\"/></startEvent>\n<!-- after -->\n<message id=\"msgOrder\" name=\"orderMessage\"/>\n<message id=\"msgCancel\" name=\"cancelMessage\"/>\n<startEvent id=\"s1\"><messageEventDefinition messageRef=\"msgOrder\"/></startEvent>\n<startEvent id=\"s2\"><messageEventDefinition messageRef=\"msgCancel\"/></startEvent>","handlingStrategy":"validation","validationCode":"Set<String> names = new HashSet<>();\nfor (String msgStart : collectMessageStartEventNames(processXml)) {\n    if (!names.add(msgStart)) throw new IllegalStateException(\"Duplicate message start name: \" + msgStart);\n}","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.createDeployment().addClasspathResource(model).deploy();\n} catch (org.activiti.engine.ActivitiException e) {\n    if (e.getMessage().contains(\"multiple message event subscriptions\")) {\n        // fix the model: make each message start event name unique\n    }\n}","preventionTips":["Model each message start event with a distinct message element/name","Review merged process models for duplicated start events","Validate BPMN with a schema/designer check before deployment"],"tags":["bpmn","deployment","message-event","duplicate-subscription"],"backgroundTag":"conflicting-event-subscription","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"}