flowable/flowable-engine · error · FlowableIllegalArgumentException
task tenant id is null
Error message
task tenant id is null
What it means
Flowable's TaskQueryImpl.taskTenantId() validates its argument before storing the query filter. Passing a null tenant id would produce an ambiguous SQL predicate, so the library fails fast with FlowableIllegalArgumentException. The caller must supply a non-null tenant id string (or use taskWithoutTenantId for null-tenant tasks).
Solutions
- Pass an actual tenant id string, e.g. .taskTenantId("acme")
- If you mean tasks with no tenant, call taskWithoutTenantId() instead
- Null-check the variable before building the query and skip the filter or fall back to a default tenant
Example fix
// before
String tenant = getTenantFromSession(); // may be null
List<Task> tasks = taskService.createTaskQuery().taskTenantId(tenant).list();
// after
String tenant = getTenantFromSession();
TaskQuery query = taskService.createTaskQuery();
if (tenant != null) { query = query.taskTenantId(tenant); }
List<Task> tasks = query.list(); Defensive patterns
Strategy: validation
Validate before calling
if (tenantId == null) {
throw new IllegalArgumentException("tenantId must be set before calling taskTenantId");
}
query.taskTenantId(tenantId); Type guard
boolean hasTenant(String t) { return t != null && !t.trim().isEmpty(); } Try / catch
try {
tasks = taskService.createTaskQuery().taskTenantId(tenantId).list();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
log.warn("Invalid query argument: {}", e.getMessage());
tasks = Collections.emptyList();
} Prevention
- Resolve tenant id from a guaranteed source (authenticated principal) with a configured default
- Null-check tenant ids at the entry point of your service layer
- Use taskWithoutTenantId() for null-tenant tasks instead of passing null
- Write a unit test covering queries with each dynamic filter parameter
When it happens
Trigger: Calling taskService.createTaskQuery().taskTenantId(null), directly or via a variable holding the tenant id that is null at runtime.
Common situations: Tenant id resolved from user session, config, or request header is unset/null; multi-tenant setups where a fallback default tenant was never configured.
Related errors
- Assignee is null
- Assignee is null
- AssigneeLike is null
- AssigneeLike is null
- assigneeLikeIgnoreCase is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/9d51c8ce5692025c.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java:692
this.candidateGroups = candidateGroups;
}
return this;
}
@Override
public TaskQuery ignoreAssigneeValue() {
if (orActive) {
currentOrQueryObject.ignoreAssigneeValue = true;
} else {
this.ignoreAssigneeValue = true;
}
return this;
}
@Override
public TaskQuery taskTenantId(String tenantId) {
if (tenantId == null) {
throw new FlowableIllegalArgumentException("task tenant id is null");
}
if (orActive) {
currentOrQueryObject.tenantId = tenantId;
} else {
this.tenantId = tenantId;
}
return this;
}
@Override
public TaskQuery taskTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new FlowableIllegalArgumentException("task tenant id is null");
}
if (orActive) {
currentOrQueryObject.tenantIdLike = tenantIdLike;
} else {
this.tenantIdLike = tenantIdLike;View on GitHub (pinned to d6d39ce1c6)