flowable/flowable-engine · error · FlowableException
bytes array is null
Error message
bytes array is null
What it means
Flowable's AppDeploymentBuilder.addBytes() throws this FlowableException when the byte[] argument is null. A resource must carry non-null byte content; the builder validates this before creating the AppResourceEntity.
Source
Thrown at modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java:102
}
@Override
public AppDeploymentBuilder addString(String resourceName, String text) {
if (text == null) {
throw new FlowableException("text is null");
}
AppResourceEntity resource = resourceEntityManager.create();
resource.setName(resourceName);
resource.setBytes(text.getBytes(StandardCharsets.UTF_8));
deployment.addResource(resource);
return this;
}
@Override
public AppDeploymentBuilder addBytes(String resourceName, byte[] bytes) {
if (bytes == null) {
throw new FlowableException("bytes array is null");
}
AppResourceEntity resource = resourceEntityManager.create();
resource.setName(resourceName);
resource.setBytes(bytes);
deployment.addResource(resource);
return this;
}
@Override
public AppDeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {
try {
ZipEntry entry = zipInputStream.getNextEntry();
while (entry != null) {
if (!entry.isDirectory()) {
String entryName = entry.getName();
byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
AppResourceEntity resource = resourceEntityManager.create();View on GitHub (pinned to d6d39ce1c6)
Solutions
- Check bytes != null before calling addBytes.
- Fix the upstream read so it throws on failure rather than returning null.
- Use Files.readAllBytes(path) which throws NoSuchFileException on missing files.
- Catch FlowableException and report the failing resourceName.
Example fix
// before
builder.addBytes("my-app.bar", readFileQuietly(path)); // may return null
// after
byte[] bytes = java.nio.file.Files.readAllBytes(path); // throws on missing
builder.addBytes("my-app.bar", bytes); Defensive patterns
Strategy: validation
Validate before calling
if (bytes == null) { throw new IllegalArgumentException("bytes must not be null for resource " + resourceName); } Type guard
boolean hasBytes(byte[] b) { return b != null && b.length > 0; } Try / catch
try {
builder.addBytes(resourceName, bytes);
} catch (org.flowable.common.engine.api.FlowableException e) {
logger.error("addBytes failed for {}: {}", resourceName, e.getMessage());
throw e;
} Prevention
- Use Files.readAllBytes or InputStream.readAllBytes which throw on failure
- Avoid helper methods that return null byte arrays
- Check array length > 0 to also catch empty payloads
When it happens
Trigger: Calling addBytes(resourceName, null) — e.g. reading file bytes with a method that returned null on failure instead of throwing.
Common situations: File-reading helper that silently returns null when the file is missing, or a downloaded artifact stored in a null variable, then handed to addBytes.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/4824887b3498fc66.
Report an issue: GitHub.