flowable/flowable-engine · error · FlowableException

Error reading image stream

Error message

Error reading image stream

What it means

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.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/CaseDefinitionImageResource.java:60

@Api(tags = { "Case Definitions" }, authorizations = { @Authorization(value = "basicAuth") })
public class CaseDefinitionImageResource extends BaseCaseDefinitionResource {

    @ApiOperation(value = "Get a case definition image", tags = { "Case Definitions" })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates request was successful and the case definitions are returned"),
            @ApiResponse(code = 404, message = "Indicates the requested case definition was not found.")
    })
    @GetMapping(value = "/cmmn-repository/case-definitions/{caseDefinitionId}/image", produces = MediaType.IMAGE_PNG_VALUE)
    public ResponseEntity<byte[]> getImageResource(@ApiParam(name = "caseDefinitionId") @PathVariable String caseDefinitionId) {
        CaseDefinition caseDefinition = getCaseDefinitionFromRequest(caseDefinitionId);
        try (final InputStream imageStream = repositoryService.getCaseDiagram(caseDefinition.getId())) {
            if (imageStream != null) {
                HttpHeaders responseHeaders = new HttpHeaders();
                responseHeaders.set("Content-Type", MediaType.IMAGE_PNG_VALUE);
                try {
                    return new ResponseEntity<>(IOUtils.toByteArray(imageStream), responseHeaders, HttpStatus.OK);
                } catch (Exception e) {
                    throw new FlowableException("Error reading image stream", e);
                }
            } else {
                throw new FlowableObjectNotFoundException("Case definition with id '" + caseDefinition.getId() + "' has no image.");
            }
            
        } catch (IOException e) {
            throw new FlowableException("Error reading image stream", e);
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the server stack trace for the wrapped cause; fix the underlying IO/lob-store problem.
  2. Redeploy the case definition including a valid diagram resource.
  3. Check that the deployment actually contains the image resource referenced by the model.
  4. Verify storage (DB LOB table or filesystem) integrity and free space.
Defensive patterns

Strategy: try-catch

Try / catch

try { ResponseEntity<byte[]> img = ...; } catch (FlowableException e) { log.error("Image read failed", e); return fallbackImage(); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/ee98168054eb3b37. Report an issue: GitHub.