flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find deployment with id

Error message

Could not find deployment with id ${deploymentId}

What it means

Flowable throws this FlowableObjectNotFoundException when SetDeploymentParentDeploymentIdCmd.execute cannot load a DeploymentEntity for the given deploymentId via the DeploymentEntityManager. It means the runtime is being asked to change a deployment's parent, but no deployment with that id exists in the ACT_GE_DEPLOYMENT table. The command aborts before updating parentDeploymentId.

Solutions

  1. Print and verify the actual deployment id via RepositoryService.createDeploymentQuery().list() and use that id
  2. Check you are connected to the same database/schema where the deployment was created
  3. Re-create or re-deploy the resource if the deployment was deleted, then re-run the command
  4. If the deployment may legitimately be absent, wrap the call in try/catch for FlowableObjectNotFoundException and handle the missing case

Example fix

// before
managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd("my-deployment", parentId));
// after
Deployment dep = repositoryService.createDeploymentQuery().deploymentName("my-app").latest().singleResult();
managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(dep.getId(), parentId));
Defensive patterns

Strategy: validation

Validate before calling

Deployment dep = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (dep == null) {
    throw new IllegalStateException("Deployment not found: " + deploymentId);
}

Type guard

boolean deploymentExists(String deploymentId) {
    return deploymentId != null
        && repositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0;
}

Try / catch

try {
    managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));
} catch (FlowableObjectNotFoundException e) {
    log.warn("Deployment {} does not exist", deploymentId, e);
}

Prevention

When it happens

Trigger: Calling ManagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, newParentDeploymentId)) with a deployment id that was never created, was deleted (e.g. via RepositoryService.deleteDeployment), or belongs to a different database/tenant.

Common situations: Hardcoded or stale deployment ids in scripts; running against a different database (test vs prod) than the one that created the deployment; cascaded deletes removing the deployment; id mismatch after re-deployment produces a new 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/cb0dde0a07a4fafd. Report an issue: GitHub.

Appendix: source

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

        DeploymentEntity 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)