{"record":{"id":"5b496fdda3a1951e","repo":"flowable/flowable-engine","slug":"could-not-find-a-deployment-with-id-deploymenti-5b496f","errorCode":null,"errorMessage":"Could not find a deployment with id '${deploymentId}'.","messagePattern":"Could not find a deployment with id '(.+?)'\\.","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/persistence/deploy/DeploymentManager.java","lineNumber":166,"sourceCode":"                deployment.addResource(resource);\n            }\n\n            deployment.setNew(false);\n            deploy(deployment, null);\n            cachedDecision = deployment.getDecisionCacheEntry(decisionId);\n\n            if (cachedDecision == null) {\n                throw new FlowableException(\"deployment '\" + deploymentId + \"' didn't put decision '\" + decisionId + \"' in the cache\");\n            }\n        }\n        return cachedDecision;\n    }\n\n    public void removeDeployment(String deploymentId) {\n\n        DmnDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId);\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\");\n        }\n\n        // Remove any dmn definition from the cache\n        List<DmnDecision> definitions = new DecisionQueryImpl().deploymentId(deploymentId).list();\n\n        // Delete data\n        deploymentEntityManager.deleteDeployment(deploymentId);\n\n        FlowableEventDispatcher eventDispatcher = engineConfig.getEventDispatcher();\n        for (DmnDecision definition : definitions) {\n            decisionCache.remove(definition.getId());\n            if (eventDispatcher != null && eventDispatcher.isEnabled()) {\n                eventDispatcher.dispatchEvent(new FlowableEntityEventImpl(definition, FlowableEngineEventType.DEFINITION_UNDEPLOYED),\n                        engineConfig.getEngineCfgKey());\n            }\n        }\n    }\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/persistence/deploy/DeploymentManager.java#L148-L184","documentation":"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.","triggerScenarios":"Calling removeDeployment with an id that was never created, already deleted, or from a different engine/database.","commonSituations":"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.","solutions":["Verify the deployment exists first: dmnRepositoryService.createDeploymentQuery().deploymentId(id).singleResult(), and skip deletion when null.","Treat the id as already-deleted if a previous delete succeeded; make deletion idempotent in your code.","Check you are operating on the right engine configuration/database where the deployment was made."],"exampleFix":"// before\ndeploymentManager.removeDeployment(deploymentId); // throws if already gone\n// after\nif (dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult() != null) {\n    deploymentManager.removeDeployment(deploymentId);\n}","handlingStrategy":"validation","validationCode":"boolean exists = dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0;","typeGuard":null,"tryCatchPattern":"try { deploymentManager.removeDeployment(deploymentId); } catch (FlowableObjectNotFoundException e) { log.info(\"deployment {} already removed\", deploymentId); /* idempotent */ }","preventionTips":["Make deployment deletion idempotent (ignore not-found)","Record deployment ids from createDeployment().deploy() instead of hard-coding","Use the DMN engine's deployment query, not the process engine's, for DMN deployment ids"],"tags":["flowable-dmn","not-found","deployment","idempotency"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}