{"record":{"id":"5e71968dc4094f64","repo":"flowable/flowable-engine","slug":"error-converting-resource-stream-5e7196","errorCode":null,"errorMessage":"Error converting resource stream","messagePattern":"Error converting resource stream","errorType":"http","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/BaseDeploymentResourceDataResource.java","lineNumber":74,"sourceCode":"        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", CmmnDeployment.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessDeploymentById(deployment);\n        }\n\n        List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);\n\n        if (resourceList.contains(resourceName)) {\n            String contentType = contentTypeResolver.resolveContentType(resourceName);\n            response.setContentType(contentType);\n            \n            try (final InputStream resourceStream = repositoryService.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 + \"'.\", String.class);\n        }\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/BaseDeploymentResourceDataResource.java#L56-L83","documentation":"When the resource exists in the deployment, the endpoint streams it via repositoryService.getResourceAsStream and reads it with IOUtils.toByteArray. Any exception during that I/O (closed stream, storage backend failure, corruption) is wrapped in a FlowableException with message 'Error converting resource stream', preserving the cause and surfacing as HTTP 500.","triggerScenarios":"GET /cmmn-repository/deployments/{deploymentId}/res/{resourceName} where the resource record exists but its underlying byte content cannot be read from the deployment store (database blob, filesystem).","commonSituations":"Database connectivity drops mid-read; a manually pruned/corrupted ACT_GE_BYTEARRAY row; storage migration left content missing; very large resources hitting timeouts or memory limits.","solutions":["Inspect the wrapped cause in the server log/HTTP 500 response to find the underlying I/O problem.","Verify database/storage health and re-check connectivity used by the Flowable engine.","Re-deploy the resource to recreate its byte content, then retry the request.","Retry the request if the failure was transient (connection reset, temporary DB outage)."],"exampleFix":"// before\nbyte[] data = get(\"/cmmn-repository/deployments/\" + id + \"/res/\" + name).body(); // 500, no retry\n// after\ntry {\n  byte[] data = get(url).body();\n} catch (HttpServerErrorException e) {\n  data = retry(url, 3); // transient stream/storage failures\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await fetchResourceData(deploymentId, name);\n} catch (e) {\n  if (e.response?.status === 500 && /Error converting resource stream/.test(e.response.data?.message)) {\n    await sleep(backoff(attempt));\n    return fetchResourceData(deploymentId, name); // retry transient I/O\n  }\n  throw e;\n}","preventionTips":["Check the server logs for the wrapped cause of this FlowableException.","Monitor database/storage health for the Flowable schema.","Re-deploy resources whose blob content may have been corrupted or pruned.","Set bounded retries with backoff for resource downloads."],"tags":["io","rest-api","server-error"],"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"}