flowable/flowable-engine · error · FlowableException

Error creating attachment data

Error message

Error creating attachment data

What it means

Wrapping FlowableException raised when converting the attachment's InputStream to a byte array (IOUtils.toByteArray) fails, or building the response entity otherwise errors. The original exception is preserved as the cause.

Solutions

  1. Check the cause exception for the underlying IO/storage error
  2. Verify the content store location, permissions, and connectivity
  3. For large attachments, increase memory or stream content instead of buffering
  4. Confirm the content record is not corrupted/truncated
Defensive patterns

Strategy: try-catch

Validate before calling

const att = await api.getTaskAttachment(taskId, attachmentId);
if (att && att.size > 50 * 1024 * 1024) console.warn('Large attachment; consider streaming');

Try / catch

try { return await api.getAttachmentContent(taskId, attachmentId); } catch (e) { log.error('Attachment download failed', e); throw new Error('Attachment content could not be read; check content store'); }

Prevention

When it happens

Trigger: GET .../attachments/{attachmentId}/content where reading the content stream fails mid-read — storage backend IO error, stream closed early, network failure to a remote content store, or OOM on very large attachments.

Common situations: Filesystem content store path missing or permissions changed; DB blob column unreadable; remote content store (e.g. S3) unreachable; attachments larger than available memory since the whole stream is buffered in memory.

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/8796454050577b41. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskAttachmentContentResource.java:86

        HttpHeaders responseHeaders = new HttpHeaders();
        MediaType mediaType = null;
        if (attachment.getType() != null) {
            try {
                mediaType = MediaType.valueOf(attachment.getType());
                responseHeaders.set("Content-Type", attachment.getType());
            } catch (Exception e) {
                // ignore if unknown media type
            }
        }

        if (mediaType == null) {
            responseHeaders.set("Content-Type", "application/octet-stream");
        }

        try {
            return new ResponseEntity<>(IOUtils.toByteArray(attachmentStream), responseHeaders, HttpStatus.OK);
        } catch (Exception e) {
            throw new FlowableException("Error creating attachment data", e);
        }
    }
}

View on GitHub (pinned to d6d39ce1c6)