{"record":{"id":"2b8b0cb1438cef71","repo":"flowable/flowable-engine","slug":"no-resource-found-with-name-resourcename-in-d","errorCode":null,"errorMessage":"no resource found with name '${resourceName}' in deployment '${deploymentId}'","messagePattern":"no resource found with name '(.+?)' in deployment '(.+?)'","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":55,"sourceCode":"        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":37,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java#L37-L62","documentation":"FlowableObjectNotFoundException thrown when the deployment exists but findResourceByDeploymentIdAndResourceName returned no resource for that exact name. The second branch of the null-resource check: the deployment lookup succeeded, so the resource name must be wrong. Thrown with InputStream.class as the expected type.","triggerScenarios":"Calling repositoryService.getResource(deploymentId, resourceName) with a name that is not an exact, case-sensitive match of a deployed resource — e.g. 'diagram.bpmn' vs 'diagram.bpmn20.xml', wrong path prefix, or the resource was never included in the deployment.","commonSituations":"Case-sensitivity mismatches (Dev built on Windows, deployed to Linux); assuming a PNG diagram exists when only the BPMN XML was deployed; hard-coded names that broke after renaming the resource file.","solutions":["List actual names: repositoryService.getDeploymentResourceNames(deploymentId) and use an exact entry.","Compare case-sensitively and check the full resource path (subdirectories are part of the name).","Catch FlowableObjectNotFoundException and check getEntityClass()==InputStream.class to distinguish from a missing deployment.","Redeploy including the missing resource if it genuinely should exist."],"exampleFix":"// before\nrepositoryService.getResource(depId, \"myProcess.bpmn\");\n// after\nString name = repositoryService.getDeploymentResourceNames(depId).stream()\n    .filter(n -> n.endsWith(\".bpmn20.xml\") || n.endsWith(\".bpmn\")).findFirst()\n    .orElseThrow(() -> new IllegalStateException(\"no bpmn resource\"));\nrepositoryService.getResource(depId, name);","handlingStrategy":"fallback","validationCode":"List<String> available = repositoryService.getDeploymentResourceNames(deploymentId);\nif (!available.contains(resourceName)) {\n    resourceName = available.stream().filter(n -> n.endsWith(\".bpmn\") || n.endsWith(\".bpmn20.xml\"))\n        .findFirst().orElse(null);\n}","typeGuard":"boolean hasResource(String deploymentId, String name) {\n    return repositoryService.getDeploymentResourceNames(deploymentId)\n        .stream().anyMatch(name::equals);\n}","tryCatchPattern":"try {\n    return repositoryService.getResource(deploymentId, resourceName);\n} catch (FlowableObjectNotFoundException e) {\n    if (InputStream.class.equals(e.getEntityClass())) {\n        // deployment exists but name mismatch: fall back to first bpmn resource\n        return loadFirstBpmnResource(deploymentId);\n    }\n    throw e;\n}","preventionTips":["Treat resource names as case-sensitive full paths including subdirectories.","Never hard-code resource names; list them from the deployment first.","Deploy diagrams/DTOs together with the BPMN file when the UI expects them.","Watch for Windows-vs-Linux case differences between build and deployment."],"tags":["flowable","resource","not-found","naming"],"backgroundTag":"record-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"}