{"record":{"id":"f90b1cd4d072ffd1","repo":"flowable/flowable-engine","slug":"failed-to-read-resource-f90b1c","errorCode":null,"errorMessage":"Failed to read resource ","messagePattern":"Failed to read resource ","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"modules/flowable-spring/src/main/java/org/flowable/spring/configurator/AbstractProcessAutoDeploymentStrategy.java","lineNumber":65,"sourceCode":"        return engine.getManagementService().getLockManager(determineLockName(deploymentNameHint));\n    }\n\n    protected void addResource(Resource resource, DeploymentBuilder deploymentBuilder) {\n        String resourceName = determineResourceName(resource);\n        addResource(resource, resourceName, deploymentBuilder);\n    }\n\n    protected void addResource(Resource resource, String resourceName, DeploymentBuilder deploymentBuilder) {\n        try (InputStream inputStream = resource.getInputStream()) {\n            if (resourceName.endsWith(\".bar\") || resourceName.endsWith(\".zip\") || resourceName.endsWith(\".jar\")) {\n                try (ZipInputStream zipStream = new ZipInputStream(inputStream)) {\n                    deploymentBuilder.addZipInputStream(zipStream);\n                }\n            } else {\n                deploymentBuilder.addInputStream(resourceName, inputStream);\n            }\n        } catch (IOException ex) {\n            throw new UncheckedIOException(\"Failed to read resource \" + resource, ex);\n        }\n    }\n\n}\n","sourceCodeStart":47,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-spring/src/main/java/org/flowable/spring/configurator/AbstractProcessAutoDeploymentStrategy.java#L47-L70","documentation":"AbstractProcessAutoDeploymentStrategy.addResource reads a process definition resource (BPMN/bar/zip) from a Spring Resource as an InputStream and registers it on a DeploymentBuilder. If reading the stream fails with an IOException (file unreadable, closed stream, IO error), the IOException is wrapped in this UncheckedIOException with the offending resource in the message. It aborts the auto-deployment of that resource.","triggerScenarios":"Auto-deployment of process definitions at application startup (processes/ directory scanning) when a matched resource cannot be read: the underlying file was removed between scan and read, permissions deny reading, or the stream is corrupt/closed.","commonSituations":"Processes directory contains unreadable files (permissions, symlinks, deleted-on-the-fly files in containers); classpath resources packed/obfuscated in ways getResourceAsStream cannot read; broken archives mounted into the deployment directory.","solutions":["Verify the resource exists and is readable by the process user: check file permissions, mounts, and that the file wasn't deleted at startup.","Validate the resource content — fix or remove the corrupt BPMN/bar/zip file from the processes/ directory.","If reading from the classpath inside a fat jar, ensure the resource is actually packaged (rebuild) and read via resource.getInputStream() on the Spring Resource, not custom file I/O.","Add startup logging to identify which resource fails and exclude problematic files from the deployment folder."],"exampleFix":"// before: unreadable resource in processes/ dir fails startup\n// UncheckedIOException: Failed to read resource file:/app/processes/broken.bpmn20.xml\n\n// after: check readability before including it in deployment scan\nResource res = resourceLoader.getResource(\"classpath:processes/broken.bpmn20.xml\");\nif (res.exists() && res.isReadable()) {\n    // will be picked up by auto-deployment\n} else {\n    log.warn(\"Skipping unreadable process resource: \" + res);\n}","handlingStrategy":"validation","validationCode":"if (!resource.isReadable()) {\n    log.warn(\"Skipping unreadable process resource: \" + resource);\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    deploymentBuilder.addInputStream(name, inputStream);\n} catch (UncheckedIOException e) {\n    log.error(\"Cannot read process resource \" + e.getMessage(), e);\n    // skip or fail startup deliberately\n}","preventionTips":["Check file permissions and mount health of the processes directory before startup","Validate BPMN/zip files in CI before packaging them into the deployment artifact","Avoid mutating the deployment directory while the application is starting"],"tags":["io","auto-deployment","resource-read","spring"],"backgroundTag":"file-read-failed","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"}