flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a deployment with id ''.

Error message

Could not find a deployment with id ''.

What it means

FlowableObjectNotFoundException thrown by AppDeploymentManager.removeDeployment when no deployment with the given id exists in the app engine. The delete operation is refused because there is nothing to undeploy.

Source

Thrown at modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppDeploymentManager.java:130

            deployment.setNew(false);
            deploy(deployment, null);
            cachedAppDefinition = deployment.getAppDefinitionCacheEntry(appDefinitionId);

            if (cachedAppDefinition == null) {
                throw new FlowableException("deployment '" + deploymentId + "' didn't put app definition '" + appDefinitionId + "' in the cache");
            }
        }
        return cachedAppDefinition;
    }
    
    public void removeDeployment(String deploymentId) {
        removeDeployment(deploymentId, true);
    }
    
    public void removeDeployment(String deploymentId, boolean cascade) {
        AppDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId);
        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", AppDeploymentEntity.class);
        }
        
        List<EngineDeployer> engineUnDeployers = new ArrayList<>(deployers);
        engineUnDeployers.sort(Comparator.comparingInt(EngineDeployer::getUndeployOrder));

        for (EngineDeployer deployer : engineUnDeployers) {
            deployer.undeploy(deployment, cascade);
        }

        FlowableEventDispatcher eventDispatcher = appEngineConfiguration.getEventDispatcher();
        for (AppDefinition appDefinition : new AppDefinitionQueryImpl().deploymentId(deploymentId).list()) {
            appDefinitionCache.remove(appDefinition.getId());
            if (eventDispatcher != null && eventDispatcher.isEnabled()) {
                eventDispatcher.dispatchEvent(new FlowableEntityEventImpl(appDefinition, FlowableEngineEventType.DEFINITION_UNDEPLOYED),
                        appEngineConfiguration.getEngineCfgKey());
            }
        }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check the id exists first via repositoryService.createDeploymentQuery().deploymentId(id).singleResult()
  2. Ensure you use an app-engine deployment id (ACT_APP_DEPLOYMENT), not a process deployment id
  3. Skip the delete if the deployment is already gone (idempotent handling)
  4. Point the engine configuration at the database that actually holds the deployment

Example fix

// before
repoService.deleteDeployment(deploymentId);
// after
if (repoService.createDeploymentQuery().deploymentId(deploymentId).count() > 0) {
    repoService.deleteDeployment(deploymentId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (repoService.createDeploymentQuery().deploymentId(deploymentId).count() == 0) {
    return; // already deleted or wrong id
}
repoService.deleteDeployment(deploymentId);

Prevention

When it happens

Trigger: Calling repositoryService.deleteDeployment(deploymentId) (with or without cascade) using an id that was already deleted, never existed, or belongs to a different engine's table prefix.

Common situations: Double-delete after an earlier cleanup script ran; deleting by a process/deployment id from flowable-engine instead of the app-engine deployment id; environment mismatch (dev id used against test DB); database recreated between steps.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/0e0b1d59db17c9a7. Report an issue: GitHub.