{"record":{"id":"5833713890a12312","repo":"flowable/flowable-engine","slug":"could-not-find-a-deployment-with-id-deploymentid-583371","errorCode":null,"errorMessage":"Could not find a deployment with id '<deploymentId>'.","messagePattern":"Could not find a deployment with id '<deploymentId>'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentResourceCollectionResource.java","lineNumber":66,"sourceCode":"\n    @Autowired\n    protected AppRepositoryService repositoryService;\n    \n    @Autowired(required=false)\n    protected AppRestApiInterceptor restApiInterceptor;\n\n    @ApiOperation(value = \"List resources in a deployment\", tags = { \"App Deployments\" }, nickname=\"listDeploymentResources\",\n            notes = \"The dataUrl property in the resulting JSON for a single resource contains the actual URL to use for retrieving the binary resource.\")\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the deployment was found and the resource list has been returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested deployment was not found.\")\n    })\n    @GetMapping(value = \"/app-repository/deployments/{deploymentId}/resources\", produces = \"application/json\")\n    public List<AppDeploymentResourceResponse> getDeploymentResources(@ApiParam(name = \"deploymentId\") @PathVariable String deploymentId) {\n        // Check if deployment exists\n        AppDeployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", AppDeployment.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessDeploymentById(deployment);\n        }\n\n        List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);\n\n        return appResponseFactory.createDeploymentResourceResponseList(deploymentId, resourceList, contentTypeResolver);\n    }\n}\n","sourceCodeStart":48,"sourceCodeEnd":78,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentResourceCollectionResource.java#L48-L78","documentation":"Thrown by AppDeploymentResourceCollectionResource.getDeploymentResources when no deployment with the given deploymentId exists — here checked against the generic repositoryService deployment query — before listing its resources. Flowable raises FlowableObjectNotFoundException typed with AppDeployment.class.","triggerScenarios":"GET /app-repository/deployments/{deploymentId}/resources where the deployment does not exist in the queried repository (never existed, deleted, or different database/engine).","commonSituations":"Wrong base URL family (app-repository vs repository ids); stale ids after deployment cleanup; multi-environment misconfiguration pointing REST at a fresh empty DB.","solutions":["Fetch valid deployment ids via GET /app-repository/deployments first.","Verify the REST module's datasource matches where the app was deployed.","Handle FlowableObjectNotFoundException as HTTP 404 in clients.","Note the existence check uses repositoryService, not appRepositoryService — a deployment visible to the app engine but not the shared repository also triggers this; check schema/engine config."],"exampleFix":"// before\nList<ResourceResponse> res = restTemplate.getForObject(\n  \"/app-repository/deployments/\" + id + \"/resources\", List.class);\n// after\nResponseEntity<List<ResourceResponse>> resp =\n  restTemplate.getForEntity(\"/app-repository/deployments/\" + id + \"/resources\", List.class);\nif (resp.getStatusCode() == HttpStatus.NOT_FOUND) { /* unknown deployment id */ }","handlingStrategy":"validation","validationCode":"// Verify deployment id is known before listing resources\ntry {\n    restTemplate.getForObject(\"/app-repository/deployments/\" + id, AppDeploymentResponse.class);\n} catch (HttpClientErrorException.NotFound e) {\n    throw new IllegalArgumentException(\"Unknown app deployment: \" + id);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return restTemplate.getForObject(url + \"/resources\", List.class);\n} catch (HttpClientErrorException.NotFound e) {\n    logger.warn(\"No deployment {} in this repository\", id);\n    return Collections.emptyList();\n}","preventionTips":["Fetch deployment ids dynamically via the list endpoint.","Keep REST datasource in sync with the deployment environment.","Catch FlowableObjectNotFoundException as 404.","If ids should exist, verify repositoryService vs appRepositoryService visibility."],"tags":["rest","not-found","deployment","resources"],"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-14T11:17:12.474Z"}