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() loads the EventDeploymentEntity by id; if findById returns null it throws FlowableObjectNotFoundException('Could not find deployment with id ...'). The parent deployment id can only be set on an existing event deployment.

Source

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

        EventDeploymentEntity 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. Query eventRepositoryService.createDeploymentQuery() to confirm the deployment id exists and use a fresh id.
  2. Redeploy the event definitions if the deployment was deleted, then set the parent id.
  3. Verify you are not passing a deployment id from another Flowable engine.
  4. Ensure the database connection points at the intended environment.

Example fix

// before
eventRepositoryService.setDeploymentParentDeploymentId("deploy-99", "parent-1"); // deploy-99 deleted
// after
EventDeployment dep = eventRepositoryService.createDeploymentQuery().deploymentName("myEvents").singleResult();
eventRepositoryService.setDeploymentParentDeploymentId(dep.getId(), "parent-1");
Defensive patterns

Strategy: try-catch

Validate before calling

if (eventRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() == 0) {
    throw new IllegalStateException("Event deployment missing: " + deploymentId);
}

Type guard

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

Try / catch

try {
    eventRepositoryService.setDeploymentParentDeploymentId(id, parentId);
} catch (FlowableObjectNotFoundException e) {
    log.warn("Event deployment {} gone; redeploy and re-link", id, e);
}

Prevention

When it happens

Trigger: Calling setDeploymentParentDeploymentId with an id that does not exist in ACT_FO_DEPLOYMENT — wrong environment, deleted deployment, or an id from a different engine's deployment table.

Common situations: Cross-environment config (ids baked in from another DB); deployment cleanup jobs removing the child between steps; confusing process-engine deployment ids with event-registry deployment ids.

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