flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find deployment with id <deploymentId>

Error message

Could not find deployment with id <deploymentId>

What it means

SetDeploymentParentDeploymentIdCmd.execute looks up a DMN deployment by id via the deployment entity manager; if no deployment row matches the given id it throws FlowableObjectNotFoundException. This guards the parent-deployment reassignment command against operating on a nonexistent or already-deleted deployment.

Source

Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/SetDeploymentParentDeploymentIdCmd.java:49

    protected String deploymentId;
    protected String newParentDeploymentId;

    public SetDeploymentParentDeploymentIdCmd(String deploymentId, String newParentDeploymentId) {
        this.deploymentId = deploymentId;
        this.newParentDeploymentId = newParentDeploymentId;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("deploymentId is null");
        }

        // Update all entities

        DmnDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId);
        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find deployment with id " + deploymentId);
        }

        deployment.setParentDeploymentId(newParentDeploymentId);

        CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment);

        return null;

    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the deploymentId exists first via DmnRepositoryService.createDeploymentQuery().deploymentId(id).singleResult() before reassigning the parent.
  2. Confirm you are using a DMN deployment id (from DmnRepositoryService.deploy()), not a process-engine deployment id.
  3. Check the dmn engine is pointed at the same database/schema where the deployment was created.
  4. Catch FlowableObjectNotFoundException and treat it as a not-found condition rather than retrying.

Example fix

// before
managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));
// after
if (dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() == 0) {
    throw new IllegalStateException("DMN deployment " + deploymentId + " does not exist");
}
managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));
Defensive patterns

Strategy: validation

Validate before calling

if (deploymentId == null || dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() == 0) {
    throw new IllegalArgumentException("DMN deployment not found: " + deploymentId);
}

Try / catch

try {
    dmnManagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));
} catch (FlowableObjectNotFoundException e) {
    log.warn("DMN deployment {} not found", deploymentId);
}

Prevention

When it happens

Trigger: Calling SetDeploymentParentDeploymentIdCmd (or the management-service API that wraps it) with a deploymentId string that has no matching row in ACT_DMN_DEPLOYMENT, e.g. an id from a different engine's deployment table or one removed by a delete-deployment call.

Common situations: Passing a process/case-engine deployment id instead of a DMN deployment id; deployment was deleted in another node/transaction; id typo or stale id cached from a previous run; querying the wrong DMN engine's database schema.

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