{"record":{"id":"80d8dfe9d84faaa3","repo":"flowable/flowable-engine","slug":"could-not-find-a-deployment-with-id-deploymenti-80d8df","errorCode":null,"errorMessage":"Could not find a deployment with id '${deploymentId}'.","messagePattern":"Could not find a deployment with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseDeploymentResourceDataResource.java","lineNumber":57,"sourceCode":"    @Autowired\n    protected RepositoryService repositoryService;\n    \n    @Autowired(required=false)\n    protected BpmnRestApiInterceptor restApiInterceptor;\n\n    protected byte[] getDeploymentResourceData(String deploymentId, String resourceName, HttpServletResponse response) {\n\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"No deployment id provided\");\n        }\n        if (resourceName == null) {\n            throw new FlowableIllegalArgumentException(\"No resource name provided\");\n        }\n\n        // Check if deployment exists\n        Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", Deployment.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessDeploymentById(deployment);\n        }\n\n        List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);\n\n        if (resourceList.contains(resourceName)) {\n            String contentType = contentTypeResolver.resolveContentType(resourceName);\n            response.setContentType(contentType);\n            try (final InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, resourceName)) {\n                return IOUtils.toByteArray(resourceStream);\n                \n            } catch (Exception e) {\n                throw new FlowableException(\"Error converting resource stream\", e);\n            }\n            ","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseDeploymentResourceDataResource.java#L39-L75","documentation":"After parameter validation, getDeploymentResourceData queries repositoryService for the deployment with the given id; if no deployment matches, FlowableObjectNotFoundException is thrown (HTTP 404). This means the id is well-formed but no such deployment exists in the repository.","triggerScenarios":"GET /repository/deployments/{deploymentId}/resourcedata/{resourceName} with a deploymentId that is not in ACT_RE_DEPLOYMENT (deleted deployment, wrong environment, or fabricated id).","commonSituations":"Deployment deleted by cleanup/undeploy scripts while client still caches old ids; dev vs prod environment mismatch; truncated or altered id from string handling.","solutions":["Fetch current deployment ids via GET /repository/deployments and use an existing id.","Check you are pointing at the same environment/database where the deployment exists.","Handle HTTP 404 by refreshing the deployment list instead of retrying the stale id.","Verify the deployment wasn't deleted (check ACT_RE_DEPLOYMENT or the deployments endpoint)."],"exampleFix":"// before\nGET /repository/deployments/99999/resourcedata/process.bpmn20.xml\n// after\nGET /repository/deployments/2501/resourcedata/process.bpmn20.xml  // id from /repository/deployments","handlingStrategy":"try-catch","validationCode":"const deps = (await get('/repository/deployments')).data;\nif (!deps.data.some(d => d.id === deploymentId)) throw new Error(`Deployment ${deploymentId} not found`);","typeGuard":null,"tryCatchPattern":"try { return await getResourceData(deploymentId, name); }\ncatch (e) { if (e instanceof FlowableObjectNotFoundException || e.status === 404) { refreshDeployments(); return null; } throw e; }","preventionTips":["Resolve deployment ids from the API right before use; do not cache long-term.","Keep client and server pointed at the same database/environment.","Treat 404 on deployments as 'refresh id list', not retry."],"tags":["rest-api","not-found","deployment","repository"],"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-18T11:17:12.947Z"}