{"record":{"id":"7f0267d89305c998","repo":"flowable/flowable-engine","slug":"deployment-does-not-exist-deploymentid-7f0267","errorCode":null,"errorMessage":"deployment does not exist: ${deploymentId}","messagePattern":"deployment does not exist: (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":53,"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        ResourceEntity 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, Deployment.class);\n            } else {\n                throw new FlowableObjectNotFoundException(\"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\", InputStream.class);\n            }\n        }\n        return new ByteArrayInputStream(resource.getBytes());\n    }\n\n}\n","sourceCodeStart":35,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java#L35-L62","documentation":"FlowableObjectNotFoundException thrown when the requested resource was not found AND the deployment itself does not exist: getDeploymentEntityManager.findById(deploymentId) returns null. This tells the caller the deploymentId is invalid, as opposed to just the resource name being wrong. Thrown as FlowableObjectNotFoundException with Deployment.class as the offending type.","triggerScenarios":"Calling repositoryService.getResource(deploymentId, resourceName) with a deploymentId that matches no row in ACT_RE_DEPLOYMENT — deleted deployment, wrong environment/database, or a fabricated id.","commonSituations":"Cross-environment id reuse (prod id used against a test database); deployment removed by cleanup jobs or deployment cache eviction; stale ids cached in the application after a redeploy that replaced the deployment.","solutions":["Verify the deployment exists: createDeploymentQuery().deploymentId(id).singleResult() before fetching resources.","Use a stable selector (deployment key + latest version) instead of a hard-coded id.","Catch FlowableObjectNotFoundException and check getEntityClass()==Deployment.class to distinguish this from a missing resource.","If data was deleted unexpectedly, redeploy the resources to recreate the deployment."],"exampleFix":"// before\nrepositoryService.getResource(depId, \"process.bpmn20.xml\");\n// after\nif (repositoryService.createDeploymentQuery().deploymentId(depId).singleResult() == null) {\n    throw new IllegalStateException(\"Unknown deployment \" + depId);\n}\nrepositoryService.getResource(depId, \"process.bpmn20.xml\");","handlingStrategy":"try-catch","validationCode":"boolean deploymentExists = repositoryService.createDeploymentQuery()\n    .deploymentId(deploymentId).count() > 0;\nif (!deploymentExists) throw new IllegalStateException(\"Unknown deployment \" + deploymentId);","typeGuard":"boolean isValidDeployment(String id) {\n    return id != null && !id.isBlank()\n        && repositoryService.createDeploymentQuery().deploymentId(id).count() > 0;\n}","tryCatchPattern":"try {\n    return repositoryService.getResource(deploymentId, resourceName);\n} catch (FlowableObjectNotFoundException e) {\n    if (Deployment.class.equals(e.getEntityClass())) {\n        throw new NotFoundException(\"Deployment does not exist: \" + deploymentId);\n    }\n    throw e;\n}","preventionTips":["Do not persist or hard-code deployment ids across environments.","Check deployment existence before fetching resources in UI/REST flows.","Use deployment keys + latest version instead of raw ids for stable references.","Audit cleanup jobs that delete deployments still referenced by other data."],"tags":["flowable","deployment","resource-not-found","stale-id"],"backgroundTag":"entity-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}