flowable/flowable-engine · error · FlowableIllegalArgumentException
Provided id is null
Error message
Provided id is null
What it means
Flowable's TokenQueryImpl.tokenId(String id) throws FlowableIllegalArgumentException when the id argument is null. Token queries validate all criteria eagerly so bad queries fail with a clear message instead of an SQL error. A null id is not a meaningful query criterion.
Source
Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java:65
protected String userIdLike;
protected String tokenData;
protected String tokenDataLike;
public TokenQueryImpl() {
}
public TokenQueryImpl(CommandContext commandContext) {
super(commandContext);
}
public TokenQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
@Override
public TokenQuery tokenId(String id) {
if (id == null) {
throw new FlowableIllegalArgumentException("Provided id is null");
}
this.id = id;
return this;
}
@Override
public TokenQuery tokenIds(List<String> ids) {
if (ids == null) {
throw new FlowableIllegalArgumentException("Provided ids is null");
}
this.ids = ids;
return this;
}
@Override
public TokenQuery tokenValue(String tokenValue) {
if (tokenValue == null) {
throw new FlowableIllegalArgumentException("Provided token value is null");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Guard with a null check and only call tokenId when an id is present
- Skip the criterion if you intend a broad query, or use tokenIds(List) with a validated non-null list
- Log/return a domain-level 'token id missing' error from your service instead of building a query
Example fix
// before
Token token = identityService.createTokenQuery().tokenId(tokenId).singleResult();
// after
if (tokenId == null) {
throw new IllegalArgumentException("token id required");
}
Token token = identityService.createTokenQuery().tokenId(tokenId).singleResult(); Defensive patterns
Strategy: validation
Validate before calling
if (tokenId == null) { throw new IllegalArgumentException("tokenId must not be null before tokenId()"); } Type guard
boolean hasTokenId(String tokenId) { return tokenId != null && !tokenId.isEmpty(); } Try / catch
try { query.tokenId(id); } catch (FlowableIllegalArgumentException e) { log.warn("Invalid token query: {}", e.getMessage()); } Prevention
- Resolve entity lookups before using their ids in queries
- Validate request parameters before passing them into Flowable queries
- Fail fast in your own service layer with domain-specific messages
When it happens
Trigger: Calling tokenId(null) on a TokenQuery from createTokenQuery(), commonly when the token id came from a nullable variable, an entity that failed to load, or an unvalidated request parameter.
Common situations: Looking up a token by id after a lookup that returned null; passing an unset field of a DTO straight into the query builder; test code constructing queries programmatically with uninitialized values.
Related errors
- Provided ids is null
- Provided token value is null
- Provided token date is null
- Provided tokenDateBefore is null
- Provided tokenDateAfter is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/77dca70c659b90c2.
Report an issue: GitHub.