flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided exception message is null

Error message

Provided exception message is null

What it means

HistoryJobQuery.exceptionMessage(String) rejects a null exception message with FlowableIllegalArgumentException. The exception-message filter is used to find history jobs that failed with a specific error, and the library requires a concrete non-null string for it.

Solutions

  1. Only call exceptionMessage() when a non-null message is available; use exceptionMessageLike() or skip the filter otherwise
  2. Guard: if (message != null) query.exceptionMessage(message)
  3. If the source exception has a null message, substitute a fallback string like e.getClass().getName()
  4. Use the stack trace class name instead of the message for filtering when messages are unreliable

Example fix

// before
String msg = failedJob.getExceptionMessage(); // may be null
query.exceptionMessage(msg);
// after
if (msg != null) {
    query.exceptionMessage(msg);
}
Defensive patterns

Strategy: validation

Validate before calling

String msg = exception != null ? exception.getMessage() : null;
if (msg == null && exception != null) { msg = exception.getClass().getName(); }
if (msg != null) { historyJobQuery.exceptionMessage(msg); }

Type guard

boolean hasExceptionMessage(String m) { return m != null && !m.isEmpty(); }

Try / catch

try {
    query.exceptionMessage(message);
} catch (FlowableIllegalArgumentException e) {
    log.warn("exceptionMessage filter skipped: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling historyJobQuery.exceptionMessage(null), directly or in an or() block, typically when the message comes from a caught exception whose getMessage() returned null or from an uninitialized field.

Common situations: Logging/handling failed jobs where exception.getMessage() is null (e.g. NPEs without messages); forwarding a nullable message from an error-handling layer; building admin queries to find jobs that failed with a given message.

Related errors


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

Appendix: source

Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/HistoryJobQueryImpl.java:125

            this.handlerTypes = handlerTypes;
        }
        return this;
    }

    @Override
    public HistoryJobQuery withException() {
        if (inOrStatement) {
            this.currentOrQueryObject.withException = true;
        } else {
            this.withException = true;
        }
        return this;
    }

    @Override
    public HistoryJobQuery exceptionMessage(String exceptionMessage) {
        if (exceptionMessage == null) {
            throw new FlowableIllegalArgumentException("Provided exception message is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.exceptionMessage = exceptionMessage;
        } else {
            this.exceptionMessage = exceptionMessage;
        }
        return this;
    }

    @Override
    public HistoryJobQuery scopeType(String scopeType) {
        if (scopeType == null) {
            throw new FlowableIllegalArgumentException("Provided scope type is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.scopeType = scopeType;
        } else {
            this.scopeType = scopeType;

View on GitHub (pinned to d6d39ce1c6)