flowable/flowable-engine · warning · FlowableIllegalArgumentException

The event listener to be removed must not be null.

Error message

The event listener to be removed must not be null.

What it means

Thrown as FlowableIllegalArgumentException by RemoveEventListenerCommand when the FlowableEventListener passed to be removed is null. It is a simple null-guard before delegating to the CMMN engine's event dispatcher.

Solutions

  1. Ensure the listener instance is non-null and the same object that was added before calling removeEventListener
  2. Add an explicit null check in the calling code and skip removal when absent
  3. Fix the code path producing the null listener (e.g. registry lookup returning null)

Example fix

// before
cmmnEngineConfiguration.removeEventListener(listener); // listener may be null
// after
if (listener != null) {
    cmmnEngineConfiguration.removeEventListener(listener);
}
Defensive patterns

Strategy: type-guard

Type guard

boolean removable = listener != null;

Try / catch

try { cmmnEngineConfiguration.removeEventListener(listener); }
catch (FlowableIllegalArgumentException e) { /* listener was null — nothing to remove */ }

Prevention

When it happens

Trigger: Calling CmmnEngineConfiguration.eventDispatcher / removeEventListener (or the cmmnEngine configuration API wrapping it) with a null listener reference, e.g. an unassigned field or a lookup that returned null.

Common situations: DI/field never initialized; a getListener() that returned null; mistakenly removing a listener that was never registered (retained a null handle).

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveEventListenerCommand.java:38

/**
 * This command removes an event listener from the case engine.
 *
 * @author Micha Kiener
 */
public class RemoveEventListenerCommand implements Command<Void> {

    protected FlowableEventListener listener;

    public RemoveEventListenerCommand(FlowableEventListener listener) {
        super();
        this.listener = listener;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        if (listener == null) {
            throw new FlowableIllegalArgumentException("The event listener to be removed must not be null.");
        }

        CommandContextUtil.getCmmnEngineConfiguration(commandContext).getEventDispatcher().removeEventListener(listener);

        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)