flowable/flowable-engine · error · FlowableException

cmmn bytes is null

Error message

cmmn bytes is null

What it means

FlowableException thrown by the helper addCmmnBytes when the cmmnBytes parameter is null. Like addBytes, the resource entity requires actual byte content for the CMMN model, so null is rejected immediately.

Solutions

  1. Ensure the byte[] is non-null before calling addCmmnBytes
  2. Check the producer of the bytes for silent null returns
  3. Fail early with your own descriptive validation before invoking the builder

Example fix

// before
builder.addCmmnBytes("model.cmmn.xml", cmmnBytes); // may be null
// after
if (cmmnBytes == null || cmmnBytes.length == 0) { throw new IllegalStateException("CMMN bytes missing"); }
builder.addCmmnBytes("model.cmmn.xml", cmmnBytes);
Defensive patterns

Strategy: validation

Validate before calling

if (cmmnBytes == null || cmmnBytes.length == 0) { throw new IllegalArgumentException("CMMN bytes must be non-empty"); }

Type guard

static boolean hasCmmnContent(byte[] b) { return b != null && b.length > 0; }

Try / catch

try {
    builder.addCmmnBytes(resourceName, cmmnBytes);
} catch (FlowableException e) {
    if ("cmmn bytes is null".equals(e.getMessage())) {
        throw new IllegalArgumentException("CMMN model bytes missing for " + resourceName, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling addCmmnBytes(resourceName, null), typically when the CMMN XML was serialized to bytes by a step that returned null or the byte[] variable was never initialized.

Common situations: Model-to-bytes conversion returning null on failure, uninitialized fields in generated deployment code, test fixtures missing binary content.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/3e2a67e36ac064f9. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java:135

                if (!entry.isDirectory()) {
                    String entryName = entry.getName();
                    byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
                    CmmnResourceEntity resource = resourceEntityManager.create();
                    resource.setName(entryName);
                    resource.setBytes(bytes);
                    deployment.addResource(resource);
                }
                entry = zipInputStream.getNextEntry();
            }
        } catch (Exception e) {
            throw new FlowableException("problem reading zip input stream", e);
        }
        return this;
    }

    public CmmnDeploymentBuilder addCmmnBytes(String resourceName, byte[] cmmnBytes) {
        if (cmmnBytes == null) {
            throw new FlowableException("cmmn bytes is null");
        }

        CmmnResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(cmmnBytes);
        deployment.addResource(resource);
        return this;
    }

    public CmmnDeploymentBuilder addCmmnModel(String resourceName, CmmnModel cmmnModel) {
        // TODO
        return null;
    }

    @Override
    public CmmnDeploymentBuilder name(String name) {
        deployment.setName(name);
        return this;

View on GitHub (pinned to d6d39ce1c6)