flowable/flowable-engine · error · FlowableIllegalArgumentException

type is null

Error message

type is null

What it means

FlowableEventImpl is the base implementation of FlowableEvent and requires a non-null FlowableEventType. The type identifies what the event means, so constructing the event with null is treated as a programming error and FlowableIllegalArgumentException is thrown in the constructor.

Solutions

  1. Pass a valid FlowableEventType constant (e.g. from FlowableEngineEventType) when constructing the event.
  2. Fix the type-resolution/mapping code so it never returns null — throw a clearer error there if the type is unknown.
  3. Guard the call site and skip/replace the event when no type could be resolved.

Example fix

// before
FlowableEventType type = typeMap.get(externalName);
dispatcher.dispatchEvent(new FlowableEventImpl(type));

// after
FlowableEventType type = typeMap.get(externalName);
if (type != null) {
    dispatcher.dispatchEvent(new FlowableEventImpl(type));
}
Defensive patterns

Strategy: validation

Validate before calling

FlowableEventType type = resolveType(externalName);
if (type == null) {
    throw new IllegalArgumentException("No FlowableEventType mapping for '" + externalName + "'");
}
dispatcher.dispatchEvent(new FlowableEventImpl(type));

Type guard

boolean isKnownEventType(FlowableEventType t) { return t != null; }

Try / catch

try {
    dispatcher.dispatchEvent(new FlowableEventImpl(type));
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("type is null")) {
        log.error("Event constructed without a FlowableEventType");
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling new FlowableEventImpl(null) directly; generic event-creation code where the FlowableEventType variable is null (e.g. unresolved mapping from an external event name to an engine event type).

Common situations: Custom event dispatchers translating external messages to engine events where the type lookup returns null; test code building events without a type; switch/lookup tables missing a mapping for a new event type.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/event/FlowableEventImpl.java:30

 */
package org.flowable.common.engine.impl.event;

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEventType;

/**
 * Base class for all {@link FlowableEvent} implementations.
 *
 * @author Filip Hrisafov
 */
public class FlowableEventImpl implements FlowableEvent {

    protected FlowableEventType type;

    public FlowableEventImpl(FlowableEventType type) {
        if (type == null) {
            throw new FlowableIllegalArgumentException("type is null");
        }

        this.type = type;
    }

    @Override
    public FlowableEventType getType() {
        return type;
    }

    @Override
    public String toString() {
        return getClass() + " - " + type;
    }
}

View on GitHub (pinned to d6d39ce1c6)