flowable/flowable-engine · error · FlowableObjectNotFoundException
Could not find a deployment with id '" + deploymentId + "'.
Error message
Could not find a deployment with id '" + deploymentId + "'.
What it means
Flowable throws FlowableObjectNotFoundException when deleting a deployment whose id does not exist in ACT_RE_DEPLOYMENT. repositoryService.deleteDeployment(deploymentId) (cascade or not) requires an existing deployment row; a null lookup result triggers this error before any removal or Flowable 5 delegation happens.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/deploy/DeploymentManager.java:184
}
return appResourceObject;
}
public AppModel getAppResourceModel(String deploymentId) {
Object appResourceObject = getAppResourceObject(deploymentId);
if (!(appResourceObject instanceof AppModel)) {
throw new FlowableException("App resource is not of type AppModel");
}
return (AppModel) appResourceObject;
}
public void removeDeployment(String deploymentId, boolean cascade) {
DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId);
if (deployment == null) {
throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", DeploymentEntity.class);
}
if (Flowable5Util.isFlowable5Deployment(deployment, processEngineConfiguration)) {
processEngineConfiguration.getFlowable5CompatibilityHandler().deleteDeployment(deploymentId, cascade);
return;
}
for (EngineDeployer deployer : deployers) {
deployer.undeploy(deployment, cascade);
}
// Remove any process definition from the cache
List<ProcessDefinition> processDefinitions = new ProcessDefinitionQueryImpl().deploymentId(deploymentId).list();
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
for (ProcessDefinition processDefinition : processDefinitions) {
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify existence first: repositoryService.createDeploymentQuery().deploymentId(id).singleResult()
- Make deletion idempotent in cleanup code by skipping when the query returns null
- Check you are connected to the right database where the deployment lives
Example fix
// before
repositoryService.deleteDeployment(deploymentId, true);
// after
if (repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult() != null) {
repositoryService.deleteDeployment(deploymentId, true);
} Defensive patterns
Strategy: validation
Validate before calling
if (repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult() != null) {
repositoryService.deleteDeployment(deploymentId, true);
} Try / catch
try {
repositoryService.deleteDeployment(deploymentId, true);
} catch (FlowableObjectNotFoundException e) {
// already deleted — treat as idempotent success
} Prevention
- Make cleanup scripts idempotent
- Guard deletes with an existence query
- Use one shared environment/database reference for id bookkeeping
When it happens
Trigger: repositoryService.deleteDeployment("dep-1") where dep-1 was already deleted, never existed, or belongs to a different database/schema; re-running cleanup scripts that delete twice.
Common situations: Repeated teardown in tests deleting the same deployment; ids copied from another environment; deployments cleaned by another process while a job still references them.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Could not find a deployment with id ''.
- 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 deployment with id ${deploymentId}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/efea6c9d574d4bc0.
Report an issue: GitHub.