{"record":{"id":"0aaafa22b7d5765b","repo":"flowable/flowable-engine","slug":"could-not-find-a-deployment-with-id-deploymenti-0aaafa","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-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/BaseDeploymentResourceDataResource.java","lineNumber":57,"sourceCode":"    @Autowired\n    protected CmmnRepositoryService repositoryService;\n    \n    @Autowired(required=false)\n    protected CmmnRestApiInterceptor 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        CmmnDeployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", CmmnDeployment.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            \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            }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/BaseDeploymentResourceDataResource.java#L39-L75","documentation":"After validating the parameters, getDeploymentResourceData runs a deployment query with deploymentId(deploymentId).singleResult(). If no deployment exists with that id, it throws FlowableObjectNotFoundException for CmmnDeployment.class — identical behavior to BaseDeploymentResource.getCmmnDeployment — resulting in HTTP 404.","triggerScenarios":"GET /cmmn-repository/deployments/{deploymentId}/res/{resourceName} where the resourceName may be valid but the deploymentId does not match any deployed deployment.","commonSituations":"Deployment deleted via cascade delete before fetching its resources; ids copied from a different environment; typo or truncated id in the URL.","solutions":["Confirm the deployment exists: GET /cmmn-repository/deployments/{deploymentId} first.","Fetch the current deployment id list and retry with a valid id.","Re-deploy the CMMN package if the deployment was intentionally removed."],"exampleFix":"// before\nfetchResource('dead-id', 'order.cmmn.xml'); // 404\n// after\nconst deps = await get('/cmmn-repository/deployments');\nif (deps.data.some(d => d.id === deploymentId)) await fetchResource(deploymentId, 'order.cmmn.xml');","handlingStrategy":"validation","validationCode":"async function deploymentExists(deploymentId) {\n  try { await get(`/cmmn-repository/deployments/${deploymentId}`); return true; }\n  catch (e) { return e.response?.status !== 404; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await fetchResourceData(deploymentId, name);\n} catch (e) {\n  if (e.response?.status === 404 && /deployment/.test(e.response.data?.message ?? '')) {\n    throw new Error(`Deployment ${deploymentId} missing — redeploy or refresh id`);\n  }\n  throw e;\n}","preventionTips":["Check deployment existence before fetching its resources.","Handle cascade-deleted deployments by re-listing deployments.","Keep per-environment deployment registries instead of shared ids."],"tags":["rest-api","not-found","deployment"],"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-18T11:17:12.947Z"}