flowable/flowable-engine · error · FlowableObjectNotFoundException

no deployment with id

Error message

no deployment with id ${deploymentId}

What it means

RulesHelper.findKnowledgeBaseByDeploymentId looks up a KieBase in the deployment's knowledge base cache; when absent it loads the deployment from the persistence store, and if no deployment entity exists for the given id it throws FlowableObjectNotFoundException with the Deployment class. The supplied deploymentId simply does not exist in the repository.

Solutions

  1. Verify the deploymentId exists: repositoryService.createDeploymentQuery().deploymentId(id).count() > 0, and use an existing id.
  2. Look up the deployment containing the rules via repositoryService.createDeploymentQuery().latest().list() or by resource name to get the correct id.
  3. If the deployment was deleted, redeploy the rules (.drl) resources to create a new deployment and use the new id.

Example fix

// before
KieBase kb = rulesHelper.findKnowledgeBaseByDeploymentId("1234-does-not-exist");
// after
Deployment dep = repositoryService.createDeploymentQuery()
    .deploymentName("rulesDeployment").latestVersion().singleResult();
KieBase kb = rulesHelper.findKnowledgeBaseByDeploymentId(dep.getId());
Defensive patterns

Strategy: validation

Validate before calling

long count = repositoryService.createDeploymentQuery()
    .deploymentId(deploymentId).count();
if (count == 0) {
    throw new IllegalArgumentException("Deployment does not exist: " + deploymentId);
}

Try / catch

try {
    KieBase kb = rulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);
} catch (FlowableObjectNotFoundException e) {
    // e.getObjectClass() == Deployment.class: re-resolve a valid deployment id
}

Prevention

When it happens

Trigger: Invoking rules (RulesDeployer / rules task) with a deploymentId string that was never deployed or was deleted: findKnowledgeBaseByDeploymentId("bogus-id").

Common situations: Hardcoded deployment ids copied from another environment (test vs prod databases); the deployment was removed via deleteDeployment while rule artifacts still reference it; typo in the deployment id.

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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/app/RulesHelper.java:36

import org.flowable.common.engine.impl.persistence.deploy.DeploymentCache;
import org.flowable.engine.impl.persistence.entity.DeploymentEntity;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.engine.repository.Deployment;
import org.kie.api.KieBase;

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

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

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

View on GitHub (pinned to d6d39ce1c6)