flowable/flowable-engine · error · FlowableException
Could not read from inputstream
Error message
Could not read from inputstream
What it means
Thrown by InputStreamSource.getInputStream() when reading the wrapped InputStream into a byte array fails with an IOException. The source caches bytes lazily, so this occurs on the first getInputStream() call. The original IOException is the cause.
Solutions
- Inspect the cause IOException for the underlying read failure
- Ensure the InputStream is fresh/unconsumed when constructing InputStreamSource
- Check the underlying resource (file/URL/network) is available and readable
- Retry the deployment with a newly opened stream
Example fix
// before
InputStreamSource src = new InputStreamSource(sharedStream); // stream already consumed upstream
// after
InputStreamSource src = new InputStreamSource(new FileInputStream("process.bpmn20.xml")); Defensive patterns
Strategy: try-catch
Validate before calling
if (inputStream == null) throw new IllegalArgumentException("stream must not be null");
if (inputStream.available() <= 0 && expectsData) logger.warn("stream may be empty/already consumed"); Try / catch
try {
InputStream is = source.getInputStream();
} catch (FlowableException e) {
logger.error("Reading deployment resource failed", e.getCause());
throw new IOException("retry with a fresh stream", e);
} Prevention
- Always pass a freshly opened stream, never one already consumed
- Check underlying file/URL availability before deployment
- Read the cause IOException for the root read failure
When it happens
Trigger: getBytesFromInputStream throws IOException while draining the wrapped stream — e.g. the stream was already consumed and closed, or the underlying resource became unreadable mid-read.
Common situations: Deploying a process definition where the resource stream was already read elsewhere; network-backed streams (URLs, remote repos) dropping mid-read; file removed between open and read.
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
- byte array for resource
- byte array for resource
- Could not completely read inputstream
- 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/71aa08522739cbcd.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/InputStreamSource.java:47
// The bpmn parsers needs to go over the stream at least twice:
// Once for the schema validation and once for the parsing itself.
// So we keep the content of the inputstream in memory so we can
// re-read it.
protected BufferedInputStream inputStream;
protected byte[] bytes;
public InputStreamSource(InputStream inputStream) {
this.inputStream = new BufferedInputStream(inputStream);
}
@Override
public InputStream getInputStream() {
if (bytes == null) {
try {
bytes = getBytesFromInputStream(inputStream);
} catch (IOException e) {
throw new FlowableException("Could not read from inputstream", e);
}
}
return new BufferedInputStream(new ByteArrayInputStream(bytes));
}
@Override
public String toString() {
return "InputStream";
}
public byte[] getBytesFromInputStream(InputStream inStream) throws IOException {
long length = inStream.available();
byte[] bytes = new byte[(int) length];
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead = inStream.read(bytes, offset, bytes.length - offset)) >= 0) {
offset += numRead;View on GitHub (pinned to d6d39ce1c6)