flowable/flowable-engine · error · FlowableImageException
Error while generating process image
Error message
Error while generating process image
What it means
DefaultProcessDiagramCanvas.generateImage() writes the rendered BufferedImage via ImageIO.write to a ByteArrayOutputStream. If the underlying ImageIO write fails with an IOException (unsupported image type string, missing image writer, IO problem), it is wrapped in FlowableImageException with this message.
Solutions
- Verify the imageType is one of the formats supported by ImageIO (e.g. "png", "gif", "jpg") on the target JVM
- Inspect the wrapped cause exception for the real IOException
- Ensure the JDK/JRE includes standard image writers (not a minimal/headless-distilled JRE without codecs)
- Call ImageIO.getWriterFormatNames() at startup to confirm supported formats
Example fix
// before
InputStream is = canvas.generateImage("jpeg2000"); // no writer registered
// after
InputStream is = canvas.generateImage("png"); Defensive patterns
Strategy: try-catch
Validate before calling
boolean supported = java.util.Arrays.asList(javax.imageio.ImageIO.getWriterFormatNames())
.contains(imageType.toLowerCase());
if (!supported) throw new IllegalArgumentException("Unsupported image type: " + imageType); Try / catch
try {
InputStream is = canvas.generateImage(imageType);
} catch (FlowableImageException e) {
log.error("Image generation failed for type " + imageType, e.getCause());
} Prevention
- Use only PNG/GIF/JPEG image types verified with ImageIO.getWriterFormatNames()
- Never build the imageType string dynamically from unvalidated input
- Verify the runtime JRE includes standard image writers
- Log the cause chain, not just the wrapper message
When it happens
Trigger: Passing an imageType string with no registered ImageIO writer (e.g. a typo like "jpeg " or a type unsupported on the JRE); an IOException inside ImageIO.write while serializing the diagram.
Common situations: Using an exotic image format not supported by the headless JVM; running in a stripped-down container JDK without the standard image codecs; dynamically built image type strings containing errors.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- byte array for resource
- Cannot read default EL properties
- Cannot read EL properties
- could not get byte array from resource
- could not get byte array from resource
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/cf9a56cbee511fd1.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-image-generator/src/main/java/org/flowable/image/impl/DefaultProcessDiagramCanvas.java:270
LOGGER.warn("Could not load image for process diagram creation: {}", e.getMessage());
}
}
/**
* Generates an image of what currently is drawn on the canvas.
*
* Throws an {@link FlowableImageException} when {@link #close()} is already called.
*/
public InputStream generateImage(String imageType) {
if (closed) {
throw new FlowableImageException("ProcessDiagramGenerator already closed");
}
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
ImageIO.write(processDiagram, imageType, out);
return new ByteArrayInputStream(out.toByteArray());
} catch (IOException e) {
throw new FlowableImageException("Error while generating process image", e);
}
}
/**
* Generates an image of what currently is drawn on the canvas.
*
* Throws an {@link FlowableImageException} when {@link #close()} is already called.
*/
public BufferedImage generateBufferedImage(String imageType) {
if (closed) {
throw new FlowableImageException("ProcessDiagramGenerator already closed");
}
// Try to remove white space
minX = (minX <= 5) ? 5 : minX;
minY = (minY <= 5) ? 5 : minY;
BufferedImage imageToSerialize = processDiagram;
imageToSerialize = processDiagram.getSubimage(minX - 5, minY - 5, canvasWidth - minX + 5, canvasHeight - minY + 5);View on GitHub (pinned to d6d39ce1c6)