flowable/flowable-engine · error · FlowableException
dmn bytes is null
Error message
dmn bytes is null
What it means
DmnDeploymentBuilderImpl.addDmnBytes registers raw DMN bytes as a deployment resource and throws FlowableException('dmn bytes is null') when the byte array argument is null. Like addString, it is an argument-validation guard preventing a DmnResourceEntity from being persisted with null content.
Source
Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java:107
}
@Override
public DmnDeploymentBuilder addString(String resourceName, String text) {
if (text == null) {
throw new FlowableException("text is null");
}
DmnResourceEntity resource = resourceEntityManager.create();
resource.setName(resourceName);
resource.setBytes(text.getBytes(StandardCharsets.UTF_8));
deployment.addResource(resource);
return this;
}
@Override
public DmnDeploymentBuilder addDmnBytes(String resourceName, byte[] dmnBytes) {
if (dmnBytes == null) {
throw new FlowableException("dmn bytes is null");
}
DmnResourceEntity resource = resourceEntityManager.create();
resource.setName(resourceName);
resource.setBytes(dmnBytes);
deployment.addResource(resource);
return this;
}
@Override
public DmnDeploymentBuilder addDmnModel(String resourceName, DmnDefinition dmnDefinition) {
DmnXMLConverter dmnXMLConverter = new DmnXMLConverter();
String dmn20Xml = new String(dmnXMLConverter.convertToXML(dmnDefinition), StandardCharsets.UTF_8);
addString(resourceName, dmn20Xml);
return this;
}
@OverrideView on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the byte[] is non-null (and ideally non-empty) before calling addDmnBytes; throw a descriptive error at the call site.
- Trace where the bytes are produced and fix the upstream producer (file read, HTTP download, converter).
- Prefer addInputStream or addClasspathResource for file-backed content so the engine handles the I/O and its errors explicitly.
Example fix
// before
byte[] dmnBytes = fetchDmnBytes(id); // may return null
repositoryService.createDeployment().addDmnBytes("decision.dmn", dmnBytes);
// after
byte[] dmnBytes = fetchDmnBytes(id);
if (dmnBytes == null || dmnBytes.length == 0) {
throw new IllegalStateException("No DMN content fetched for id " + id);
}
repositoryService.createDeployment().addDmnBytes("decision.dmn", dmnBytes); Defensive patterns
Strategy: validation
Validate before calling
Objects.requireNonNull(dmnBytes, "DMN bytes must not be null");
if (dmnBytes.length == 0) {
throw new IllegalArgumentException("DMN bytes must not be empty");
} Try / catch
try {
builder.addDmnBytes("decision.dmn", dmnBytes);
} catch (FlowableException e) {
if ("dmn bytes is null".equals(e.getMessage())) {
throw new IllegalArgumentException("Supplied DMN bytes were null", e);
}
throw e;
} Prevention
- Guarantee the byte producer (file read, HTTP fetch) throws on failure instead of returning null.
- Check both null and length == 0 before passing content to the builder.
- Wrap I/O in try-with-resources so partial reads surface as errors, not silent nulls.
When it happens
Trigger: Calling addDmnBytes(resourceName, dmnBytes) with a null byte[] — typically when bytes came from a failed file read (readAllBytes on missing file), a null-valued HTTP response body, a stream conversion that produced null, or an unset variable holding the DMN content.
Common situations: Downloading DMN definitions from a remote service that returned no body, reading files from a directory that does not exist, deserialization utilities returning null on failure, or templating pipelines where a prior step silently failed to produce content.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1f3120e379f0c943.
Report an issue: GitHub.