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
- Confirm the deployment exists via cmmnRepositoryService.createDeploymentQuery().deploymentId(id)
- Use the CMMN repository service for CMMN deployment ids (not the BPMN one)
- Verify database/tenant configuration
- 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
- Remember cascading deletes may remove child deployments before reparenting
- Use the CMMN repository service for CMMN deployments, not the BPMN one
- Verify datasource and tenant configuration
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
- Could not find a resource with id '<resourceName>' in deploy
- Could not find an app deployment with id '<deploymentId>
- no apps deployed with key = '' and version = ''
- Could not find a deployment with id ''.
- DMN decision with key ${externalRef} was not executed. For $
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/4dc8ea20b1ec8588.
Report an issue: GitHub.