{"record":{"id":"ee98168054eb3b37","repo":"flowable/flowable-engine","slug":"error-reading-image-stream","errorCode":null,"errorMessage":"Error reading image stream","messagePattern":"Error reading image stream","errorType":"http","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/CaseDefinitionImageResource.java","lineNumber":60,"sourceCode":"@Api(tags = { \"Case Definitions\" }, authorizations = { @Authorization(value = \"basicAuth\") })\npublic class CaseDefinitionImageResource extends BaseCaseDefinitionResource {\n\n    @ApiOperation(value = \"Get a case definition image\", tags = { \"Case Definitions\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates request was successful and the case definitions are returned\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested case definition was not found.\")\n    })\n    @GetMapping(value = \"/cmmn-repository/case-definitions/{caseDefinitionId}/image\", produces = MediaType.IMAGE_PNG_VALUE)\n    public ResponseEntity<byte[]> getImageResource(@ApiParam(name = \"caseDefinitionId\") @PathVariable String caseDefinitionId) {\n        CaseDefinition caseDefinition = getCaseDefinitionFromRequest(caseDefinitionId);\n        try (final InputStream imageStream = repositoryService.getCaseDiagram(caseDefinition.getId())) {\n            if (imageStream != null) {\n                HttpHeaders responseHeaders = new HttpHeaders();\n                responseHeaders.set(\"Content-Type\", MediaType.IMAGE_PNG_VALUE);\n                try {\n                    return new ResponseEntity<>(IOUtils.toByteArray(imageStream), responseHeaders, HttpStatus.OK);\n                } catch (Exception e) {\n                    throw new FlowableException(\"Error reading image stream\", e);\n                }\n            } else {\n                throw new FlowableObjectNotFoundException(\"Case definition with id '\" + caseDefinition.getId() + \"' has no image.\");\n            }\n            \n        } catch (IOException e) {\n            throw new FlowableException(\"Error reading image stream\", e);\n        }\n    }\n\n}\n","sourceCodeStart":42,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/CaseDefinitionImageResource.java#L42-L72","documentation":"When rendering the case definition diagram, the REST resource reads the image stream with IOUtils.toByteArray and wraps any failure (null/short reads, decode issues) in FlowableException('Error reading image stream'). The outer catch on IOException rethrows the same message, so any stream error surfaces under this text.","triggerScenarios":"GET /cmmn-repository/case-definitions/{id}/resolvable-image (or image resource) where reading the resource stream fails — corrupted/missing image bytes in the deployment, interrupted stream, or IO errors on the underlying resource store.","commonSituations":"Deployments whose diagram resource is missing or corrupt; database/lob store issues truncating the byte array; custom resource converters failing; disk/IO problems on the server.","solutions":["Inspect the server stack trace for the wrapped cause; fix the underlying IO/lob-store problem.","Redeploy the case definition including a valid diagram resource.","Check that the deployment actually contains the image resource referenced by the model.","Verify storage (DB LOB table or filesystem) integrity and free space."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ResponseEntity<byte[]> img = ...; } catch (FlowableException e) { log.error(\"Image read failed\", e); return fallbackImage(); }","preventionTips":["Ensure deployments contain valid diagram resources.","Monitor LOB/storage health on the server.","Log the wrapped cause to find the storage-layer root problem."],"tags":["io","image","rest-api"],"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"}