flowable/flowable-engine · error · org.activiti.engine.ActivitiObjectNotFoundException

no deployment with id

Error message

no deployment with id ${deploymentId}

What it means

RulesHelper.findKnowledgeBaseByDeploymentId looks up the deployment by id via the DeploymentEntityManager; if no DeploymentEntity exists for that id it throws ActivitiObjectNotFoundException carrying the Deployment.class entity type. The rules (Drools) support cannot build a KieBase from a deployment that does not exist.

Solutions

  1. Query the repository (RepositoryService.createDeploymentQuery().deploymentId(deploymentId)) to confirm the id exists before running the rule task.
  2. Fix the deploymentId reference in the BPMN rule task / configuration to point at an existing deployment.
  3. Recreate the rules deployment if it was deleted, and update references to the new id.
  4. Check you are connected to the environment (database) where the deployment was actually made.

Example fix

// before
KieBase kb = RulesHelper.findKnowledgeBaseByDeploymentId("deploy-123-stale");
// after
Deployment dep = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (dep == null) throw new IllegalStateException("deployment missing: " + deploymentId);
KieBase kb = RulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);
Defensive patterns

Strategy: try-catch

Validate before calling

Deployment dep = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (dep == null) throw new IllegalStateException("no deployment: " + deploymentId);

Try / catch

try {
    return RulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);
} catch (ActivitiObjectNotFoundException e) {
    logger.warn("rules deployment {} missing; redeploy rules", deploymentId);
    throw e;
}

Prevention

When it happens

Trigger: Invoking a rule task (or otherwise triggering findKnowledgeBaseByDeploymentId) with a deploymentId that is not present in ACT_RE_DEPLOYMENT — e.g. a stale id after redeployment/cleanup or a hard-coded id from another database.

Common situations: Referencing a deployment id from an old environment, database cleaned of history while process definitions still reference the id, id copied between test and production databases, typo in the configured deployment id of a rule task.

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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/rules/RulesHelper.java:42

/**
 * @author Tom Baeyens
 */
public class RulesHelper {

    public static KieBase findKnowledgeBaseByDeploymentId(String deploymentId) {
        DeploymentCache<Object> knowledgeBaseCache = Context
                .getProcessEngineConfiguration()
                .getDeploymentManager()
                .getKnowledgeBaseCache();

        KieBase knowledgeBase = (KieBase) knowledgeBaseCache.get(deploymentId);
        if (knowledgeBase == null) {
            DeploymentEntity deployment = Context
                    .getCommandContext()
                    .getDeploymentEntityManager()
                    .findDeploymentById(deploymentId);
            if (deployment == null) {
                throw new ActivitiObjectNotFoundException("no deployment with id " + deploymentId, Deployment.class);
            }
            Context
                    .getProcessEngineConfiguration()
                    .getDeploymentManager()
                    .deploy(deployment);
            knowledgeBase = (KieBase) knowledgeBaseCache.get(deploymentId);
            if (knowledgeBase == null) {
                throw new ActivitiException("deployment " + deploymentId + " doesn't contain any rules");
            }
        }
        return knowledgeBase;
    }
}

View on GitHub (pinned to d6d39ce1c6)