flowable/flowable-engine · error · FlowableObjectNotFoundException

no deployment with id

Error message

no deployment with id 

What it means

RulesHelper.findKnowledgeBaseByDeploymentId looks up a KieBase (drools knowledge base) from the deployment cache for a given deployment id. If it is not cached, it loads the deployment; when no deployment with that id exists in ACT_RE_DEPLOYMENT it throws FlowableObjectNotFoundException. It is Flowable's rules/drools integration telling you the deployment id does not reference a persisted deployment.

Solutions

  1. Verify the deployment id exists via repositoryService.createDeploymentQuery().deploymentId(id).singleResult().
  2. Use the id returned by deployment.deploy() rather than a hardcoded value.
  3. Check you are connected to the same database/tenant where the deployment was made.
  4. If the deployment was deleted, redeploy the rules archive and use the new id.

Example fix

// before
KieBase kb = RulesHelper.findKnowledgeBaseByDeploymentId("deployment-123"); // may not exist
// after
Deployment d = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (d == null) {
    throw new IllegalStateException("Unknown deployment id: " + deploymentId);
}
KieBase kb = RulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);
Defensive patterns

Strategy: validation

Validate before calling

Deployment d = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (d == null) throw new IllegalArgumentException("Unknown deployment id: " + deploymentId);

Try / catch

try {
    return RulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);
} catch (FlowableObjectNotFoundException e) {
    log.error("No deployment {} in this database/tenant", deploymentId);
    throw e;
}

Prevention

When it happens

Trigger: Passing a deployment id to the rules helper that was never deployed, already deleted, belongs to a different engine/database, or contains a typo; calling with a process definition id instead of a deployment id.

Common situations: Hardcoded deployment ids after re-deploying to another environment; cleanup jobs deleting old deployments while rules still reference them; multi-tenant setups querying the wrong tenant's data; copying ids from a different database.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/rules/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)