{"record":{"id":"9bf6180b15b8f7ac","repo":"flowable/flowable-engine","slug":"deployment-does-not-exist-deploymentid","errorCode":null,"errorMessage":"deployment does not exist: <deploymentId>","messagePattern":"deployment does not exist: <deploymentId>","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":52,"sourceCode":"\n    public GetDeploymentResourceCmd(String deploymentId, String resourceName) {\n        this.deploymentId = deploymentId;\n        this.resourceName = resourceName;\n    }\n\n    @Override\n    public InputStream execute(CommandContext commandContext) {\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentId is null\");\n        }\n        if (resourceName == null) {\n            throw new FlowableIllegalArgumentException(\"resourceName is null\");\n        }\n\n        DmnResourceEntity resource = CommandContextUtil.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);\n        if (resource == null) {\n            if (CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId) == null) {\n                throw new FlowableObjectNotFoundException(\"deployment does not exist: \" + deploymentId);\n            } else {\n                throw new FlowableObjectNotFoundException(\"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\");\n            }\n        }\n        return new ByteArrayInputStream(resource.getBytes());\n    }\n\n}\n","sourceCodeStart":34,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetDeploymentResourceCmd.java#L34-L61","documentation":"When findResourceByDeploymentIdAndResourceName returns no resource, GetDeploymentResourceCmd distinguishes two causes. If the deployment id itself does not exist in the deployment entity manager, it throws FlowableObjectNotFoundException \"deployment does not exist: <id>\". So the deployment id is a valid format but refers to no persisted deployment.","triggerScenarios":"getDeploymentResource(\"12345\", \"file.dmn\") where 12345 was never deployed or was deleted — e.g. an id from another engine's database, a stale id after redeployment, or a fabricated id in a test.","commonSituations":"Hard-coded deployment ids after re-provisioning the database; using a process-engine deployment id against the DMN repository service (separate tables); cleanup jobs removing old deployments while code still caches ids.","solutions":["Resolve the current deployment id at runtime via createDeploymentQuery() instead of hard-coding/stale ids","Confirm you are using dmnRepositoryService (DMN deployments), not the process engine's repository service","Catch FlowableObjectNotFoundException and either redeploy the resource or return a 404-style response to the caller"],"exampleFix":"// before\nrepoService.getDeploymentResource(\"771\", \"rules.dmn\"); // stale id\n// after\nDeployment d = repoService.createDeploymentQuery().deploymentName(\"rules\").latest().singleResult();\nif (d == null) throw new NotFoundException(\"rules deployment missing\");\nrepoService.getDeploymentResource(d.getId(), \"rules.dmn\");","handlingStrategy":"try-catch","validationCode":"DmnDeploymentEntity dep = CommandContextUtil.getDeploymentEntityManager(ctx).findById(deploymentId); // or deployment query\nif (dep == null) throw new NotFoundException(\"deployment \" + deploymentId + \" not deployed\");","typeGuard":null,"tryCatchPattern":"try { return repoService.getDeploymentResource(depId, name); } catch (FlowableObjectNotFoundException e) { if (e.getMessage().startsWith(\"deployment does not exist\")) { return ResponseEntity.notFound().build(); } throw e; }","preventionTips":["Never hard-code deployment ids; resolve the latest deployment by name/key at runtime","Use the DMN repository service for DMN deployments, not the process engine's","Account for deployment cleanup jobs in id lifetime assumptions"],"tags":["flowable","dmn","deployment","resource-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}