{"record":{"id":"bd00d59afd8a1f23","repo":"flowable/flowable-engine","slug":"could-not-find-a-resource-with-id-resourcename","errorCode":null,"errorMessage":"Could not find a resource with id '<resourceName>' in deployment '<deploymentId>","messagePattern":"Could not find a resource with id '<resourceName>' in deployment '<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/AppDefinitionResourceDataResource.java","lineNumber":98,"sourceCode":"            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + appDefinition.getDeploymentId());\n        }\n\n        List<String> resourceList = appRepositoryService.getDeploymentResourceNames(appDefinition.getDeploymentId());\n\n        if (resourceList.contains(appDefinition.getResourceName())) {\n            final InputStream resourceStream = appRepositoryService.getResourceAsStream(\n                    appDefinition.getDeploymentId(), appDefinition.getResourceName());\n\n            response.setContentType(\"application/json\");\n            try {\n                return IOUtils.toByteArray(resourceStream);\n            } catch (Exception e) {\n                throw new FlowableException(\"Error converting resource stream\", e);\n            }\n            \n        } else {\n            // Resource not found in deployment\n            throw new FlowableObjectNotFoundException(\"Could not find a resource with id '\" +\n                    appDefinition.getResourceName() + \"' in deployment '\" + appDefinition.getDeploymentId());\n        }\n    }\n}\n","sourceCodeStart":80,"sourceCodeEnd":103,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDefinitionResourceDataResource.java#L80-L103","documentation":"Thrown by AppDefinitionResourceDataResource.getAppDefinitionResource when the repository returns null for the requested resourceName in the given deployment. Flowable signals 'resource not found in deployment' with FlowableObjectNotFoundException. The app definition exists, but no resource with that exact name is attached to its deployment.","triggerScenarios":"GET /app-repository/app-definitions/{appDefinitionId}/resource where repositoryService.getResourceAsStream(appDefinition.getDeploymentId(), appDefinition.getResourceName()) returns null because the resource name does not match any resource stored in that deployment.","commonSituations":"Typos or case-mismatched resource names; deployment pruned/cleaned while definition metadata remained; querying the wrong engine/database; path separators differing from what was deployed.","solutions":["List actual resources first: GET /app-repository/deployments/{deploymentId}/resources and use an exact resource name from that list.","Check case and path separators — resource lookup is exact-match; '.app' vs '.APP' or leading slashes matter.","Redeploy the app so deployment and resources are consistent again.","Catch FlowableObjectNotFoundException and return 404 instead of a 500 for missing resources."],"exampleFix":"// before\nbyte[] data = restTemplate.getForObject(url, byte[].class); // 500 on wrong name\n// after\nList<AppDeploymentResourceResponse> resources = restTemplate.getForObject(\n    \"/app-repository/deployments/\" + deploymentId + \"/resources\", List.class);\nif (resources.stream().noneMatch(r -> r.getId().equals(resourceName))) {\n    throw new IllegalArgumentException(\"Unknown resource: \" + resourceName);\n}","handlingStrategy":"validation","validationCode":"// Check resource exists before requesting its bytes\nList<AppDeploymentResourceResponse> resources = restTemplate.getForObject(\n  \"/app-repository/deployments/\" + deploymentId + \"/resources\", List.class);\nboolean exists = resources != null && resources.stream()\n  .anyMatch(r -> r.getId().equals(resourceName));","typeGuard":null,"tryCatchPattern":"try {\n    byte[] data = restTemplate.getForObject(url, byte[].class);\n} catch (HttpClientErrorException.NotFound e) {\n    throw new UnknownResourceException(resourceName, deploymentId);\n}","preventionTips":["Copy resource names from the deployment resources listing, never by hand.","Watch for case and path-separator differences.","Catch FlowableObjectNotFoundException and return 404 semantics.","Redeploy if deployment and resource metadata diverge."],"tags":["rest","flowable","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-14T05:17:10.506Z"}