flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a deployment with id

Error message

Could not find a deployment with id '${deploymentId}'.

What it means

removeDeployment throws FlowableObjectNotFoundException('Could not find a deployment with id ...') when deploymentEntityManager.findById returns null, i.e. no DMN deployment exists with that id. Nothing is deleted when this fires.

Solutions

  1. Verify the deployment exists first: dmnRepositoryService.createDeploymentQuery().deploymentId(id).singleResult(), and skip deletion when null.
  2. Treat the id as already-deleted if a previous delete succeeded; make deletion idempotent in your code.
  3. Check you are operating on the right engine configuration/database where the deployment was made.

Example fix

// before
deploymentManager.removeDeployment(deploymentId); // throws if already gone
// after
if (dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult() != null) {
    deploymentManager.removeDeployment(deploymentId);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0;

Try / catch

try { deploymentManager.removeDeployment(deploymentId); } catch (FlowableObjectNotFoundException e) { log.info("deployment {} already removed", deploymentId); /* idempotent */ }

Prevention

When it happens

Trigger: Calling removeDeployment with an id that was never created, already deleted, or from a different engine/database.

Common situations: Retry logic deleting a deployment twice; hard-coded deployment ids after redeploys; pointing at a test database while the deployment lives elsewhere; confusing process-engine deployment ids with DMN deployment ids.

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/5b496fdda3a1951e. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/persistence/deploy/DeploymentManager.java:166

                deployment.addResource(resource);
            }

            deployment.setNew(false);
            deploy(deployment, null);
            cachedDecision = deployment.getDecisionCacheEntry(decisionId);

            if (cachedDecision == null) {
                throw new FlowableException("deployment '" + deploymentId + "' didn't put decision '" + decisionId + "' in the cache");
            }
        }
        return cachedDecision;
    }

    public void removeDeployment(String deploymentId) {

        DmnDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId);
        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.");
        }

        // Remove any dmn definition from the cache
        List<DmnDecision> definitions = new DecisionQueryImpl().deploymentId(deploymentId).list();

        // Delete data
        deploymentEntityManager.deleteDeployment(deploymentId);

        FlowableEventDispatcher eventDispatcher = engineConfig.getEventDispatcher();
        for (DmnDecision definition : definitions) {
            decisionCache.remove(definition.getId());
            if (eventDispatcher != null && eventDispatcher.isEnabled()) {
                eventDispatcher.dispatchEvent(new FlowableEntityEventImpl(definition, FlowableEngineEventType.DEFINITION_UNDEPLOYED),
                        engineConfig.getEngineCfgKey());
            }
        }
    }

View on GitHub (pinned to d6d39ce1c6)