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 throws FlowableObjectNotFoundException('Could not find deployment with id <id>') when the CmmnDeploymentEntityManager.findById lookup returns null, so the parent deployment id cannot be set.

Source

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

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

        deployment.setParentDeploymentId(newParentDeploymentId);

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

        return null;

    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Confirm the deployment exists via cmmnRepositoryService.createDeploymentQuery().deploymentId(id)
  2. Use the CMMN repository service for CMMN deployment ids (not the BPMN one)
  3. Verify database/tenant configuration
  4. Catch FlowableObjectNotFoundException and return a not-found response

Example fix

// before
cmmnRepositoryService.setDeploymentParentDeploymentId(deploymentId, parentDeploymentId);
// after
if (cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0) {
    cmmnRepositoryService.setDeploymentParentDeploymentId(deploymentId, parentDeploymentId);
} else {
    logger.warn("Deployment {} not found", deploymentId);
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean exists = cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0;
if (!exists) { throw new NotFoundException("Deployment not found: " + deploymentId); }

Try / catch

try {
    cmmnRepositoryService.setDeploymentParentDeploymentId(deploymentId, parentDeploymentId);
} catch (FlowableObjectNotFoundException e) {
    throw new NotFoundException(e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling setDeploymentParentDeploymentId(id, newParentDeploymentId) with an id of a deployment that does not exist in the CMMN repository.

Common situations: Deployment deleted before reparenting (cascade delete of cascading deployments); id from a BPMN deployment used against the CMMN repository service; database/schema or tenant mismatch.

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