flowable/flowable-engine · error · FlowableIllegalArgumentException
Error exporting diagram
Error message
Error exporting diagram
What it means
getCaseInstanceDiagram reads the diagram resource for the case definition and converts it to PNG bytes. If reading the resource stream or the IOUtils.toByteArray conversion fails, the exception is wrapped in FlowableIllegalArgumentException("Error exporting diagram", e) — the underlying cause is attached, so inspect it.
Source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceDiagramResource.java:77
})
@GetMapping(value = "/cmmn-runtime/case-instances/{caseInstanceId}/diagram")
public ResponseEntity<byte[]> getCaseInstanceDiagram(@ApiParam(name = "caseInstanceId") @PathVariable String caseInstanceId) {
CaseInstance caseInstance = getCaseInstanceFromRequest(caseInstanceId);
CaseDefinition caseDef = repositoryService.getCaseDefinition(caseInstance.getCaseDefinitionId());
if (caseDef != null && caseDef.hasGraphicalNotation()) {
CmmnModel cmmnModel = repositoryService.getCmmnModel(caseDef.getId());
CaseDiagramGenerator diagramGenerator = cmmnEngineConfiguration.getCaseDiagramGenerator();
InputStream resource = diagramGenerator.generateDiagram(cmmnModel, "png", cmmnEngineConfiguration.getActivityFontName(), cmmnEngineConfiguration.getLabelFontName(),
cmmnEngineConfiguration.getAnnotationFontName(), cmmnEngineConfiguration.getClassLoader(), 1.0);
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.set("Content-Type", "image/png");
try {
return new ResponseEntity<>(IOUtils.toByteArray(resource), responseHeaders, HttpStatus.OK);
} catch (Exception e) {
throw new FlowableIllegalArgumentException("Error exporting diagram", e);
}
} else {
throw new FlowableIllegalArgumentException("Case instance with id '" + caseInstance.getId() + "' has no graphical notation defined.");
}
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the cause (e.getCause()) of the FlowableIllegalArgumentException to find the real I/O or resource error.
- Redeploy the CMMN model ensuring the diagram/diagram resource name is generated and included.
- Verify the deployment resource exists via /cmmn-repository/case-definitions/{id}/resourcename.
- Check repository blob storage integrity in the database (ACT_GE_BYTEARRAY).
Defensive patterns
Strategy: try-catch
Validate before calling
// Check the definition has a diagram before requesting it
if (!caseDefinition.hasGraphicalNotation()) { /* skip diagram fetch */ } Try / catch
try { byte[] png = getDiagram(caseInstanceId); }
catch (FlowableIllegalArgumentException e) { log.error("Diagram export failed", e.getCause()); /* fallback: serve model XML */ } Prevention
- Always inspect the cause chain of the wrapped exception
- Redeploy models with diagram data intact
- Monitor deployment resource integrity after migrations
When it happens
Trigger: GET the case instance diagram endpoint where the diagram resource exists (graphical notation is defined) but its stream cannot be read — e.g. resource missing from the deployment store, corrupt/empty PNG in the deployment, or an I/O error while reading the repository resource.
Common situations: Deployments generated without diagram data; database resource blob truncated; repository entries removed externally; issues after migrating deployments between environments.
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
- Case instance with id '${caseInstance.getId()}' has no graph
- Error while generating case image
- Error converting resource stream
- Error reading image stream
- Case definition with id '${caseDefinition.getId()}' has no i
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/f9b74576b6639839.
Report an issue: GitHub.