flowable/flowable-engine · error · ActivitiObjectNotFoundException

deployment for process definition does not exist: <deploymen

Error message

deployment for process definition does not exist: <deploymentId>

What it means

ActivitiObjectNotFoundException thrown by DeploymentManager.getBpmnModelById when the process definition exists but its referenced deployment record is missing from the database. The engine fetches the definition's resource by deploymentId and resourceName; if the resource is null AND the deployment itself cannot be found, this error is thrown. It indicates database inconsistency: the process definition row survived but its parent deployment row did not.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/persistence/deploy/DeploymentManager.java:127

            throw new ActivitiIllegalArgumentException("Invalid process definition id : null");
        }

        // first try the cache
        BpmnModel bpmnModel = bpmnModelCache.get(processDefinitionId);

        if (bpmnModel == null) {
            ProcessDefinition processDefinition = findDeployedProcessDefinitionById(processDefinitionId);
            if (processDefinition == null) {
                throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + processDefinitionId + "'", ProcessDefinition.class);
            }

            // Fetch the resource
            String resourceName = processDefinition.getResourceName();
            ResourceEntity resource = Context.getCommandContext().getResourceEntityManager()
                    .findResourceByDeploymentIdAndResourceName(processDefinition.getDeploymentId(), resourceName);
            if (resource == null) {
                if (Context.getCommandContext().getDeploymentEntityManager().findDeploymentById(processDefinition.getDeploymentId()) == null) {
                    throw new ActivitiObjectNotFoundException("deployment for process definition does not exist: "
                            + processDefinition.getDeploymentId(), Deployment.class);
                } else {
                    throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName
                            + "' in deployment '" + processDefinition.getDeploymentId() + "'", InputStream.class);
                }
            }

            // Convert the bpmn 2.0 xml to a bpmn model
            BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
            bpmnModel = bpmnXMLConverter.convertToBpmnModel(new BytesStreamSource(resource.getBytes()), false, false);
            bpmnModelCache.add(processDefinition.getId(), bpmnModel);
        }
        return bpmnModel;
    }

    public ProcessDefinition findDeployedLatestProcessDefinitionByKey(String processDefinitionKey) {
        ProcessDefinition processDefinition = Context
                .getCommandContext()

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Repair the database: either restore the missing ACT_RE_DEPLOYMENT row or delete the orphaned ACT_RE_PROCDEF rows referencing the missing deployment
  2. Redeploy the process definition to get a consistent deployment/definition pair
  3. Check for foreign-key constraints being disabled or manual SQL cleanup scripts that broke referential integrity
  4. Use RepositoryService.deleteDeployment(id, true) rather than manual deletes to remove deployments

Example fix

-- before (manual cleanup that breaks integrity)
DELETE FROM ACT_RE_DEPLOYMENT WHERE ID_ = '100';
-- after (delete the deployment through the engine)
repositoryService.deleteDeployment("100", true); // cascades to definitions and instances
Defensive patterns

Strategy: validation

Validate before calling

ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
Deployment d = pd == null ? null : repositoryService.createDeploymentQuery().deploymentId(pd.getDeploymentId()).singleResult();
if (d == null) throw new IllegalStateException("Orphaned process definition, deployment missing: " + id);

Try / catch

try {
    return repositoryService.getBpmnModel(pdId);
} catch (ActivitiObjectNotFoundException e) {
    log.error("DB inconsistency for definition {}", pdId, e);
    return null;
}

Prevention

When it happens

Trigger: Calling getBpmnModelById(processDefinitionId) where ACT_RE_PROCDEF has a row whose deploymentId has no matching row in ACT_RE_DEPLOYMENT.

Common situations: Manual database cleanup that deleted ACT_RE_DEPLOYMENT rows but not ACT_RE_PROCDEF rows, partial rollback during deleteDeployment, or restoring a database backup incompletely.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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