{"record":{"id":"ad42615cfdb130e3","repo":"flowable/flowable-engine","slug":"error-converting-resource-stream-ad4261","errorCode":null,"errorMessage":"Error converting resource stream","messagePattern":"Error converting resource stream","errorType":"http","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-dmn-rest/src/main/java/org/flowable/dmn/rest/service/api/repository/BaseDecisionResource.java","lineNumber":99,"sourceCode":"        DmnDeployment deployment = deploymentQuery.singleResult();\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessDeploymentById(deployment);\n        }\n\n        List<String> resourceList = dmnRepositoryService.getDeploymentResourceNames(deploymentId);\n\n        if (resourceList.contains(resourceId)) {\n            String contentType = contentTypeResolver.resolveContentType(resourceId);\n            response.setContentType(contentType);\n            try (final InputStream resourceStream = dmnRepositoryService.getResourceAsStream(deploymentId, resourceId)) {\n                return IOUtils.toByteArray(resourceStream);\n                \n            } catch (Exception e) {\n                throw new FlowableException(\"Error converting resource stream\", e);\n            }\n        } else {\n            // Resource not found in deployment\n            throw new FlowableObjectNotFoundException(\"Could not find a resource with id '\" + resourceId + \"' in deployment '\" + deploymentId);\n        }\n    }\n}\n","sourceCodeStart":81,"sourceCodeEnd":107,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-rest/src/main/java/org/flowable/dmn/rest/service/api/repository/BaseDecisionResource.java#L81-L107","documentation":"Once the resource is confirmed present, the method streams it via dmnRepositoryService.getResourceAsStream and converts it with IOUtils.toByteArray; any exception in that read/convert path is wrapped in a generic FlowableException(\"Error converting resource stream\", e). It signals an I/O or engine-level failure while reading resource bytes, not a missing resource.","triggerScenarios":"dmnRepositoryService.getResourceAsStream(deploymentId, resourceId) throws or the stream read fails: database blob read error, connection loss mid-read, underlying FlowableException from the repository service for an unreadable resource row, or IOUtils.toByteArray IOException.","commonSituations":"Database connectivity problems or timeouts while fetching the GEBYTEARRAY blob row; corrupted byte-array rows after a partial deploy or DB migration; connection-pool exhaustion; large resources hitting stream/socket timeouts.","solutions":["Inspect the wrapped cause (getCause()) — the real failure (SQL error, IO error) is chained and logged.","Verify database health and connection-pool settings; retry the request once connectivity is restored.","Check the ACT_GEBYTEARRAY row for the resource; if corrupted, redeploy the deployment.","For large resources, increase JDBC/network timeouts and heap used by the REST app."],"exampleFix":"// before\nbyte[] data = resource.getDeploymentResourceData(deploymentId, resourceId, response); // wrapped FlowableException\n// after\ntry {\n    byte[] data = resource.getDeploymentResourceData(deploymentId, resourceId, response);\n} catch (FlowableException e) {\n    logger.error(\"Resource read failed; cause:\", e.getCause());\n    retryWithBackoff(() -> resource.getDeploymentResourceData(deploymentId, resourceId, response));\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    byte[] data = client.getDeploymentResourceData(deploymentId, resourceId);\n} catch (FlowableException e) {\n    Throwable cause = e.getCause(); // inspect real IO/SQL failure\n    if (isTransient(cause)) retryWithBackoff(...); else throw e;\n}","preventionTips":["Monitor DB connectivity and connection-pool saturation","Log the wrapped cause, not just the wrapper message","Size connection/read timeouts for your largest resources"],"tags":["io","stream","database"],"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-14T16:17:12.679Z"}