{"record":{"id":"239a25c3bfefc0b6","repo":"flowable/flowable-engine","slug":"error-converting-resource-stream-239a25","errorCode":null,"errorMessage":"Error converting resource stream","messagePattern":"Error converting resource stream","errorType":"exception","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentResourceDataResource.java","lineNumber":89,"sourceCode":"        // Check if deployment exists\n        AppDeployment deployment = appRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find an app deployment with id '\" + deploymentId);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessDeploymentById(deployment);\n        }\n\n        List<String> resourceList = appRepositoryService.getDeploymentResourceNames(deploymentId);\n\n        if (resourceList.contains(resourceName)) {\n            response.setContentType(\"application/json\");\n            try (final InputStream resourceStream = appRepositoryService.getResourceAsStream(deploymentId, resourceName)) {\n                return IOUtils.toByteArray(resourceStream);\n                \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 name '\" + resourceName + \"' in deployment '\" + deploymentId);\n        }\n    }\n}\n","sourceCodeStart":71,"sourceCodeEnd":98,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentResourceDataResource.java#L71-L98","documentation":"FlowableException wrapping any exception raised while reading the deployment resource stream and converting it to a byte array with IOUtils.toByteArray. It signals an I/O or engine-level failure while streaming the resource, not a missing resource (that has its own error). The original exception is attached as the cause.","triggerScenarios":"GET .../resources/{resourceName} when appRepositoryService.getResourceAsStream(deploymentId, resourceName) throws (e.g. database blob read failure) or the InputStream cannot be read fully.","commonSituations":"Database connectivity drops mid-read, corrupted blob data in ACT_GE_BYTEARRAY, missing JDBC driver class in older setups.","solutions":["Inspect the wrapped cause exception in the stack trace","Verify database connectivity and integrity of the resource blobs","Re-deploy the app to recreate the resource entry","Retry the request if it was a transient connection failure"],"exampleFix":"// server log shows cause: 'Could not get JDBC Connection'\n// fix: restore DB connectivity / pool, then retry\n// before\nGET /app-repository/app-deployments/123/resources/app.json  -> 500\n// after (DB healthy)\n200 OK with JSON body","handlingStrategy":"try-catch","validationCode":"if (appRepositoryService.getDeploymentResourceNames(deploymentId).contains(resourceName)) { /* safe to fetch */ }","typeGuard":null,"tryCatchPattern":"try { byte[] data = /* REST call */; } catch (FlowableException e) { Throwable cause = e.getCause(); log.error(\"Resource stream failed\", cause); }","preventionTips":["Monitor database connectivity used by the engine","Check the cause chain when this error appears","Re-deploy apps whose blobs may be corrupted"],"tags":["rest","io","flowable"],"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"}