{"record":{"id":"4da5dac7a93d6119","repo":"flowable/flowable-engine","slug":"error-converting-resource-stream-4da5da","errorCode":null,"errorMessage":"Error converting resource stream","messagePattern":"Error converting resource stream","errorType":"http","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseDeploymentResourceDataResource.java","lineNumber":73,"sourceCode":"        Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", Deployment.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            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":55,"sourceCodeEnd":82,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseDeploymentResourceDataResource.java#L55-L82","documentation":"When the resource exists in the deployment, its content stream is read via repositoryService.getResourceAsStream and converted with IOUtils.toByteArray. Any exception during stream reading/conversion is wrapped in FlowableException(\"Error converting resource stream\", e). This signals an I/O or deserialization problem, not a missing resource.","triggerScenarios":"The resource stream from the database (ACT_GE_BYTEARRAY) fails to read/convert: corrupt stored bytes, database connection dropped mid-read, or an IOException inside IOUtils.toByteArray.","commonSituations":"Corrupted deployment artifacts in ACT_GE_BYTEARRAY; database connectivity issues or timeouts during large resource reads; character/encoding problems when the underlying storage was migrated.","solutions":["Inspect the wrapped cause (getCause()) to find the underlying IO/database error.","Redeploy the resource to replace potentially corrupted bytes in ACT_GE_BYTEARRAY.","Check database connectivity and increase timeouts for large resources.","Retry the request; if persistent, restore the deployment from source artifacts."],"exampleFix":"// before\nbyte[] data = restTemplate.getForObject(url, byte.class); // opaque 500\n// after\ntry { ... } catch (HttpServerErrorException e) { log.error(cause); redeploy(resource); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return await getResourceData(deploymentId, name); }\ncatch (e) { if (isResourceStreamError(e)) { log.error('Root cause', e.cause); return redeployAndRetry(deploymentId, name); } throw e; }","preventionTips":["Maintain healthy database connectivity; watch for dropped connections during large reads.","Redeploy resources rather than patching ACT_GE_BYTEARRAY rows manually.","Log the wrapped cause — this error always carries the original exception."],"tags":["rest-api","io","stream","deployment-resource"],"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"}