flowable/flowable-engine · error · FlowableException

event definition bytes is null

Error message

event definition bytes is null

What it means

FlowableException thrown by EventDeploymentBuilderImpl.addEventDefinitionBytes when the byte[] argument is null. The bytes become an EventResourceEntity added to the deployment, and a null payload is rejected upfront.

Solutions

  1. Verify the byte[] is non-null (and non-empty) before calling addEventDefinitionBytes.
  2. Check that the file/stream that produced the bytes was read successfully.
  3. Use addEventDefinition(String) for classpath-loaded definitions to let Flowable handle loading.

Example fix

// before
byte[] bytes = loadBytes("order.event.json"); // may be null
builder.addEventDefinitionBytes("order.event.json", bytes);
// after
byte[] bytes = loadBytes("order.event.json");
if (bytes == null || bytes.length == 0) {
    throw new IllegalStateException("order.event.json failed to load");
}
builder.addEventDefinitionBytes("order.event.json", bytes);
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean ok = bytes != null && bytes.length > 0;

Try / catch

try { builder.addEventDefinitionBytes(name, bytes); } catch (FlowableException e) { LOG.error("null event definition bytes"); throw e; }

Prevention

When it happens

Trigger: Calling deploymentBuilder.addEventDefinitionBytes(resourceName, null); e.g. bytes read from a file that failed to load or a cache miss returning null.

Common situations: Reading event definition JSON/XML files at startup where the file read silently returned null; deserialization utilities returning null on failure.

Related errors


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

Appendix: source

Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java:104

    }

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

        EventResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));
        deployment.addResource(resource);
        return this;
    }

    @Override
    public EventDeploymentBuilder addEventDefinitionBytes(String resourceName, byte[] eventDefinitionBytes) {
        if (eventDefinitionBytes == null) {
            throw new FlowableException("event definition bytes is null");
        }

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

    @Override
    public EventDeploymentBuilder addEventDefinition(String resourceName, String eventDefinition) {
        addString(resourceName, eventDefinition);
        return this;
    }
    
    @Override
    public EventDeploymentBuilder addChannelDefinitionBytes(String resourceName, byte[] channelDefinitionBytes) {
        if (channelDefinitionBytes == null) {

View on GitHub (pinned to d6d39ce1c6)