flowable/flowable-engine · error · FlowableException

text is null

Error message

text is null

What it means

FlowableException thrown by CmmnDeploymentBuilderImpl.addString when the text parameter is null. The builder requires non-null content because it immediately encodes the text to UTF-8 bytes as a deployment resource. It is a fail-fast argument validation error.

Solutions

  1. Ensure the String passed to addString is non-null before calling
  2. Check the upstream producer of the XML string (file read, DB query, generator) for null returns
  3. Default or fail early in your own code with a clearer message
  4. Use addBytes/addInputStream instead if you truly have byte content, not text

Example fix

// before
builder.addString("model.cmmn.xml", loadModelXml()); // may return null
// after
String xml = loadModelXml();
if (xml == null) { throw new IllegalStateException("CMMN model XML not loaded"); }
builder.addString("model.cmmn.xml", xml);
Defensive patterns

Strategy: validation

Validate before calling

if (text == null || text.trim().isEmpty()) { throw new IllegalArgumentException("CMMN model text must be non-empty"); }

Type guard

static boolean isValidModelText(String text) { return text != null && !text.trim().isEmpty(); }

Try / catch

try {
    builder.addString(resourceName, text);
} catch (FlowableException e) {
    if ("text is null".equals(e.getMessage())) {
        throw new IllegalArgumentException("Model XML for " + resourceName + " was null", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling cmmnRepositoryService.createDeployment().addString(resourceName, null), or passing a variable that was expected to hold the model XML but resolved to null (e.g. failed file read, unmapped config value).

Common situations: Programmatically generating CMMN XML where the generator returned null, loading model content from a database/config that returned null, refactoring that dropped an assignment before the addString call.

Related errors


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

Appendix: source

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

    }

    @Override
    public CmmnDeploymentBuilder 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) {
            throw new FlowableException("Failed to read resource " + resource, ex);
        }
    }

    @Override
    public CmmnDeploymentBuilder addString(String resourceName, String text) {
        if (text == null) {
            throw new FlowableException("text is null");
        }

        CmmnResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));
        deployment.addResource(resource);
        return this;
    }
    
    @Override
    public CmmnDeploymentBuilder addBytes(String resourceName, byte[] bytes) {
        if (bytes == null) {
            throw new FlowableException("bytes array is null");
        }

        CmmnResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(bytes);

View on GitHub (pinned to d6d39ce1c6)