flowable/flowable-engine · warning · FlowableException
byte array for resource
Error message
byte array for resource '${resourceName}' is null What it means
After attempting to read the InputStream into a byte array, addInputStream checks whether the result is null and throws this error. IOUtils.toByteArray normally throws on failure rather than returning null, so this is a defensive guard against a null conversion result.
Solutions
- Verify you are using the standard org.flowable version of EventDeploymentBuilderImpl and commons-io IOUtils; upgrade Flowable if a patched version fixes this path
- Check the InputStream implementation for a toByteArray path that returns null and replace it with a plain stream (FileInputStream, ByteArrayInputStream)
- Log stream contents/availability before the call to confirm bytes exist
Example fix
// before deploymentBuilder.addInputStream(name, weirdStream); // custom stream returning null bytes // after deploymentBuilder.addInputStream(name, new FileInputStream(file)); // normal stream
Defensive patterns
Strategy: try-catch
Validate before calling
byte[] check = IOUtils.toByteArray(inputStream);
if (check == null) throw new IllegalStateException("byte conversion produced null for " + resourceName); Try / catch
try {
deploymentBuilder.addInputStream(name, stream);
} catch (FlowableException e) {
if (e.getMessage().contains("byte array for resource")) {
// replace custom stream wrapper with a standard stream implementation
} else { throw e; }
} Prevention
- Use standard stream implementations (FileInputStream, ByteArrayInputStream)
- Avoid custom InputStream subclasses with unusual read semantics
- Keep Flowable and commons-io at stock versions
When it happens
Trigger: addInputStream where the byte conversion yields null (defensive path — practically only if IOUtils.toByteArray returns null, e.g. unusual IOUtil behavior or custom subclasses).
Common situations: Rare in practice; encountered when using custom IO utilities, exotic stream wrappers, or modified/copied code where the byte reading logic differs from stock Apache Commons IO behavior.
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
- could not get byte array from resource
- could not get byte array from resource
- Failed to read resource
- Failed to read resource
- problem reading zip input stream
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/b1796c2b0fb858fe.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java:65
this.deployment = eventRegistryEngineConfiguration.getDeploymentEntityManager().create();
this.resourceEntityManager = eventRegistryEngineConfiguration.getResourceEntityManager();
}
@Override
public EventDeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
if (inputStream == null) {
throw new FlowableException("inputStream for resource '" + resourceName + "' is null");
}
byte[] bytes = null;
try {
bytes = IOUtils.toByteArray(inputStream);
} catch (Exception e) {
throw new FlowableException("could not get byte array from resource '" + resourceName + "'", e);
}
if (bytes == null) {
throw new FlowableException("byte array for resource '" + resourceName + "' is null");
}
EventResourceEntity resource = resourceEntityManager.create();
resource.setName(resourceName);
resource.setBytes(bytes);
deployment.addResource(resource);
return this;
}
@Override
public EventDeploymentBuilder addClasspathResource(String resource) {
try (final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resource)) {
if (inputStream == null) {
throw new FlowableException("resource '" + resource + "' not found");
}
return addInputStream(resource, inputStream);
} catch (IOException ex) {View on GitHub (pinned to d6d39ce1c6)