flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided token data is null

Error message

Provided token data is null

What it means

TokenQueryImpl.tokenData(String) filters tokens by exact token data (e.g. the serialized/hashed token value). A null argument is rejected with FlowableIllegalArgumentException because null is not a valid equality criterion. Fail-fast validation keeps query semantics unambiguous.

Solutions

  1. Ensure the token data value is computed/available before the lookup; bail out earlier if the raw token was absent.
  2. Conditionally apply tokenData only for non-null values.
  3. If the token was not supplied at all, reject the request upstream rather than querying with null.

Example fix

// before
String data = hasher.hash(rawToken); // null if rawToken is null
Token token = identityService.createTokenQuery().tokenData(data).singleResult();

// after
if (rawToken == null) {
    throw new InvalidTokenException("Token value missing");
}
String data = hasher.hash(rawToken);
Token token = identityService.createTokenQuery().tokenData(data).singleResult();
Defensive patterns

Strategy: validation

Validate before calling

if (tokenData == null) {
    throw new InvalidTokenException("Token data must be computed before lookup");
}
identityService.createTokenQuery().tokenData(tokenData);

Type guard

boolean hasTokenData(String v) { return v != null && !v.isEmpty(); }

Try / catch

try {
    query.tokenData(data);
} catch (FlowableIllegalArgumentException e) {
    throw new InvalidTokenException("Token lookup aborted: token data was null", e);
}

Prevention

When it happens

Trigger: Calling TokenQuery.tokenData(null), e.g. identityService.createTokenQuery().tokenData(hashedValue) where the hashed value computation returned null.

Common situations: Token lookup flows where the incoming raw token was null/absent and hashing still ran; cache or lookup misses returned null; misconfigured token providers.

Related errors


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

Appendix: source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java:173

            throw new FlowableIllegalArgumentException("Provided user id is null");
        }
        this.userId = userId;
        return this;
    }

    @Override
    public TokenQuery userIdLike(String userIdLike) {
        if (userIdLike == null) {
            throw new FlowableIllegalArgumentException("Provided userIdLike is null");
        }
        this.userIdLike = userIdLike;
        return this;
    }

    @Override
    public TokenQuery tokenData(String tokenData) {
        if (tokenData == null) {
            throw new FlowableIllegalArgumentException("Provided token data is null");
        }
        this.tokenData = tokenData;
        return this;
    }

    @Override
    public TokenQuery tokenDataLike(String tokenDataLike) {
        if (tokenDataLike == null) {
            throw new FlowableIllegalArgumentException("Provided tokenDataLike is null");
        }
        this.tokenDataLike = tokenDataLike;
        return this;
    }

    // sorting //////////////////////////////////////////////////////////

    @Override
    public TokenQuery orderByTokenId() {

View on GitHub (pinned to d6d39ce1c6)