flowable/flowable-engine · error · ActivitiObjectNotFoundException

No process definition found for id '<processDefinitionId>'

Error message

No process definition found for id '<processDefinitionId>'

What it means

StartProcessInstanceByMessageCmd throws ActivitiObjectNotFoundException when the process definition ID stored in the message subscription cannot be resolved to a deployed ProcessDefinitionEntity via the DeploymentManager. The subscription exists but its target definition is no longer deployed, so the engine cannot instantiate it and fails with ProcessDefinition.class as the missing type.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceByMessageCmd.java:85

        MessageEventSubscriptionEntity messageEventSubscription = commandContext.getEventSubscriptionEntityManager()
                .findMessageStartEventSubscriptionByName(messageName, tenantId);

        if (messageEventSubscription == null) {
            throw new ActivitiObjectNotFoundException("Cannot start process instance by message: no subscription to message with name '" + messageName + "' found.", MessageEventSubscriptionEntity.class);
        }

        String processDefinitionId = messageEventSubscription.getConfiguration();
        if (processDefinitionId == null) {
            throw new ActivitiException("Cannot start process instance by message: subscription to message with name '" + messageName + "' is not a message start event.");
        }

        DeploymentManager deploymentManager = commandContext
                .getProcessEngineConfiguration()
                .getDeploymentManager();

        ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) deploymentManager.findDeployedProcessDefinitionById(processDefinitionId);
        if (processDefinition == null) {
            throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class);
        }

        // Do not start process a process instance if the process definition is suspended
        if (deploymentManager.isProcessDefinitionSuspended(processDefinition.getId())) {
            throw new ActivitiException("Cannot start process instance. Process definition "
                    + processDefinition.getName() + " (id = " + processDefinition.getId() + ") is suspended");
        }

        ActivityImpl startActivity = processDefinition.findActivity(messageEventSubscription.getActivityId());
        ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, startActivity);

        if (processVariables != null) {
            processInstance.setVariables(processVariables);
        }
        if (transientVariables != null) {
            processInstance.setTransientVariables(transientVariables);
        }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Redeploy the process definition so the referenced definition ID resolves (or a new subscription is created).
  2. Delete orphaned subscriptions pointing at missing definitions from ACT_RU_EVENT_SUBSCRIPTION.
  3. Use cascade=true when deleting deployments that have active message start subscriptions, and verify subscription validity after cleanup.

Example fix

// before
repositoryService.deleteDeployment(deploymentId, false);
runtimeService.startProcessInstanceByMessage("OrderReceived");
// after
repositoryService.deleteDeployment(deploymentId, true); // cascade removes subscriptions too
runtimeService.startProcessInstanceByMessage("OrderReceived");
Defensive patterns

Strategy: validation

Validate before calling

boolean definitionDeployed = repositoryService.createProcessDefinitionQuery()
        .processDefinitionId(subscription.getConfiguration()).count() > 0;

Try / catch

try {
    runtimeService.startProcessInstanceByMessage(messageName);
} catch (ActivitiObjectNotFoundException e) {
    logger.error("Message '{}' points at undeployed definition; redeploying", messageName, e);
    repositoryService.createDeployment().addClasspathResource("processes/order.bpmn20.xml").deploy();
}

Prevention

When it happens

Trigger: Message correlation where the subscription's configuration references a processDefinitionId removed by repositoryService.deleteDeployment(..., cascade=false) or deleted directly from the repository tables.

Common situations: Non-cascading deployment cleanup removing definitions while event subscriptions persisted; restoring DB snapshots of event subscriptions without matching definition rows; cache/deployment mismatch after redeploy in a cluster.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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