flowable/flowable-engine · error · FlowableObjectNotFoundException
Could not find deployment with id <deploymentId>
Error message
Could not find deployment with id <deploymentId>
What it means
Same lookup guard as the parent-deployment command: SetDeploymentTenantIdCmd loads the deployment by id and throws FlowableObjectNotFoundException when findById returns null, before it updates the tenant and cascades direct SQL updates to dependent entities.
Source
Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/SetDeploymentTenantIdCmd.java:52
protected String deploymentId;
protected String newTenantId;
public SetDeploymentTenantIdCmd(String deploymentId, String newTenantId) {
this.deploymentId = deploymentId;
this.newTenantId = newTenantId;
}
@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.setTenantId(newTenantId);
// Doing process instances, executions and tasks with direct SQL updates
// (otherwise would not be performant)
CommandContextUtil.getDecisionEntityManager(commandContext).updateDecisionTenantIdForDeployment(deploymentId, newTenantId);
// Doing decision tables in memory, cause we need to clear the decision table cache
List<DmnDecision> decisionTables = new DecisionQueryImpl().deploymentId(deploymentId).list();
for (DmnDecision decisionTable : decisionTables) {
CommandContextUtil.getDmnEngineConfiguration().getDefinitionCache().remove(decisionTable.getId());
}
CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment);
return null;
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Confirm existence with dmnRepositoryService.createDeploymentQuery().deploymentId(id).singleResult() first.
- Verify the id is a DMN deployment id, not one from the process/case engine.
- Ensure the engine configuration points at the database where the deployment was deployed.
- Catch FlowableObjectNotFoundException and handle as a 404-style condition.
Example fix
// before
dmnManagementService.executeCommand(new SetDeploymentTenantIdCmd(deploymentId, newTenantId));
// after
DmnDeployment dep = dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (dep == null) {
throw new IllegalArgumentException("Unknown DMN deployment: " + deploymentId);
}
dmnManagementService.executeCommand(new SetDeploymentTenantIdCmd(deploymentId, newTenantId)); Defensive patterns
Strategy: validation
Validate before calling
DmnDeployment dep = dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (dep == null) throw new IllegalArgumentException("Unknown DMN deployment: " + deploymentId); Try / catch
try {
dmnManagementService.executeCommand(new SetDeploymentTenantIdCmd(deploymentId, tenantId));
} catch (FlowableObjectNotFoundException e) {
// treat as 404
} Prevention
- Verify deployment existence before tenant changes
- Ensure engine datasource matches where the deployment lives
- Never reuse ids across engines
When it happens
Trigger: Executing SetDeploymentTenantIdCmd with a deploymentId that does not exist in the DMN deployment table — wrong-engine id, deleted deployment, or mismatched database schema.
Common situations: Re-tenanting a deployment after it was deleted; copying ids from flowable logs of a different engine; multi-tenant setups where the deployment lives in another tenant's 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
- Required decision <decisionId> is not available
- No decision found for key <decisionKey>. There was also no f
- No decision found for key <decisionKey>. There was also no f
- No decision found for key <decisionKey>, parent deployment i
- Could not find deployment with id <deploymentId>
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/516b8e9c48ffd41c.
Report an issue: GitHub.