flowable/flowable-engine · error · FlowableException

Cannot deploy process definition '${processDefinition.getRes

Error message

Cannot deploy process definition '${processDefinition.getResourceName()}': there already is a message event subscription for the message with name '${messageName}'. For ${eventSubscriptionEntity}

What it means

Thrown by MessageStartEventActivityBehavior.deploy when a new process definition is deployed containing a message start event whose message name already has an active start-event subscription (an EventSubscriptionEntity with no process instance id) in the same tenant. Flowable enforces that a message name can only be consumed by one message start event per tenant, otherwise a message would trigger multiple/ambiguous starts.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/MessageStartEventActivityBehavior.java:62

        CommandContext commandContext = context.getCommandContext();
        EventSubscriptionService eventSubscriptionService = context.getEventSubscriptionService();
        ProcessDefinitionEntity processDefinition = context.getProcessDefinition();

        String messageName = EventDefinitionExpressionUtil.determineMessageName(commandContext, messageEventDefinition, processDefinition);

        // Skip the duplicate check when restoring a previous version's start events after the latest
        // deployment was deleted: the just-deleted process definition's subscription is still in the in-session entity
        // cache (the bulk delete in deleteEventSubscriptionsForProcessDefinition is queued, not flushed)
        // and would trip a false-positive conflict.
        if (!context.isRestoringPreviousVersion()) {
            List<EventSubscriptionEntity> subscriptionsForSameMessageName = eventSubscriptionService
                    .findEventSubscriptionsByName(MessageEventHandler.EVENT_HANDLER_TYPE, messageName, processDefinition.getTenantId());

            for (EventSubscriptionEntity eventSubscriptionEntity : subscriptionsForSameMessageName) {
                // throw exception only if there's already a subscription as start event
                if (eventSubscriptionEntity.getProcessInstanceId() == null || eventSubscriptionEntity.getProcessInstanceId().isEmpty()) {
                    // the event subscription has no instance-id, so it's a message start event
                    throw new FlowableException("Cannot deploy process definition '" + processDefinition.getResourceName()
                            + "': there already is a message event subscription for the message with name '" + messageName + "'. For " + eventSubscriptionEntity);
                }
            }
        }

        MessageEventSubscriptionEntity newSubscription = eventSubscriptionService.createMessageEventSubscription();
        newSubscription.setEventName(messageName);
        newSubscription.setActivityId(context.getStartEvent().getId());
        newSubscription.setConfiguration(processDefinition.getId());
        newSubscription.setProcessDefinitionId(processDefinition.getId());

        if (processDefinition.getTenantId() != null) {
            newSubscription.setTenantId(processDefinition.getTenantId());
        }

        eventSubscriptionService.insertEventSubscription(newSubscription);
        CountingEntityUtil.handleInsertEventSubscriptionEntityCount(newSubscription);
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Rename the message on the new definition's message start event (message name attribute in BPMN XML / message element) so it is unique per tenant.
  2. Remove or cancel the existing message start event subscription, e.g. by deleting the old process definition that owns it, before deploying the new one.
  3. Query existing subscriptions (runtimeService.createEventSubscriptionQuery().eventName(messageName)) to find which definition holds the conflicting subscription and resolve it.
  4. Deploy the updated definition under a different tenant if the same message name must coexist across tenants.

Example fix

<!-- before: duplicate message name across definitions -->
<message id="orderMsg" name="orderReceived"/>
<!-- after: unique name for the new definition -->
<message id="orderMsgV2" name="orderReceivedV2"/>
Defensive patterns

Strategy: validation

Validate before calling

List<EventSubscription> subs = runtimeService.createEventSubscriptionQuery()
    .eventType("message").eventName("orderReceived").list();
boolean hasStartSubscription = subs.stream()
    .anyMatch(s -> s.getProcessInstanceId() == null || s.getProcessInstanceId().isEmpty());
if (hasStartSubscription) throw new IllegalStateException("message name already used by a start event");

Try / catch

try {
    repositoryService.createDeployment().addClasspathResource(model).deploy();
} catch (FlowableException ex) {
    if (ex.getMessage() != null && ex.getMessage().contains("already is a message event subscription")) {
        logger.error("Conflicting message start event: {}", ex.getMessage());
    }
    throw ex;
}

Prevention

When it happens

Trigger: repositoryService.deploy() of a process definition whose message start event uses a message name already subscribed by another deployed process definition's start event (same tenant), or redeploying/updating a definition when the old start-event subscription has not been removed.

Common situations: Two different process models accidentally reusing the same message name in their start events; deploying an updated BPMN while the previous version's start subscription lingers; multi-tenant deployments where the same message name is checked per tenant; copy-pasting a process model and forgetting to rename its start message.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/808b89c6ba38cdf8. Report an issue: GitHub.