flowable/flowable-engine · error · ActivitiObjectNotFoundException

no deployed process definition found with id

Error message

no deployed process definition found with id '${processDefinitionId}'

What it means

findDeployedProcessDefinitionById resolved neither the definition cache nor the database: the process definition entity with the given id does not exist (or its deployment was deleted), so it throws ActivitiObjectNotFoundException with ProcessDefinition.class. Unlike 4705 the id was non-null — it just doesn't match any deployed definition.

Solutions

  1. Verify existence: repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult(); if null, the id is wrong or deleted
  2. List actual definitions (processDefinitionKey/latestVersion) and use the correct current id
  3. Check ACT_RE_PROCDEF for the id; if missing but runtime rows reference it, clean those runtime rows or restore the deployment
  4. If deleted unintentionally, redeploy the BPMN (note the id is deployment-scoped; a redeploy yields a new id — update callers)

Example fix

// before: blindly using a stored id
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
if (pd == null) throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + id + "'", ProcessDefinition.class);
// after: resolve latest by key instead of trusting a stale id
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
    .processDefinitionKey(key).latestVersion().singleResult();
Defensive patterns

Strategy: validation

Validate before calling

if (repositoryService.createProcessDefinitionQuery()
        .processDefinitionId(id).count() == 0) {
  throw new IllegalStateException("no deployed process definition with id " + id + " — resolve latest by key instead");
}

Type guard

Optional<ProcessDefinition> findDefinition(String id) {
  return Optional.ofNullable(repositoryService.createProcessDefinitionQuery()
      .processDefinitionId(id).singleResult());
}

Try / catch

try {
  repositoryService.getBpmnModel(defId);
} catch (FlowableObjectNotFoundException e) {
  if (e.getObjectClass() != null && ProcessDefinition.class.equals(e.getObjectClass())) {
    // re-resolve by key/latestVersion or restore the deployment
  } else { throw e; }
}

Prevention

When it happens

Trigger: Passing a definition id from another environment/database, an id of a definition whose deployment was deleted (deleteDeployment without cascade leaving references), or a typo'd/truncated id from a REST path parameter.

Common situations: Cross-environment data copies (test id used in prod); partial cascade deletes leaving runtime rows pointing at removed definitions; stale cached ids in a client after a redeploy that changed ids.

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/1de8d302e7c44ba3. Report an issue: GitHub.

Appendix: source

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

        for (Deployer deployer : deployers) {
            deployer.deploy(deployment, deploymentSettings);
        }
    }

    public ProcessDefinition findDeployedProcessDefinitionById(String processDefinitionId) {
        if (processDefinitionId == null) {
            throw new ActivitiIllegalArgumentException("Invalid process definition id : null");
        }

        // first try the cache
        ProcessDefinitionCacheEntry cacheEntry = processDefinitionCache.get(processDefinitionId);
        ProcessDefinition processDefinition = null;
        if (cacheEntry == null) {
            processDefinition = Context.getCommandContext()
                    .getProcessDefinitionEntityManager()
                    .findProcessDefinitionById(processDefinitionId);
            if (processDefinition == null) {
                throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + processDefinitionId + "'", ProcessDefinition.class);
            }
            processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition();

        } else {
            processDefinition = cacheEntry.getProcessDefinition();
        }
        return processDefinition;
    }

    public ProcessDefinitionEntity findProcessDefinitionByIdFromDatabase(String processDefinitionId) {
        if (processDefinitionId == null) {
            throw new ActivitiIllegalArgumentException("Invalid process definition id : null");
        }

        ProcessDefinitionEntity processDefinition = Context.getCommandContext()
                .getProcessDefinitionEntityManager()
                .findProcessDefinitionById(processDefinitionId);

View on GitHub (pinned to d6d39ce1c6)