flowable/flowable-engine · error · FlowableIllegalArgumentException
Execution id is null
Error message
Execution id is null
What it means
executionId() pins the query to a single execution by its database ID. Flowable throws FlowableIllegalArgumentException when the ID string is null, since an ID equality predicate cannot be formed from null. Failing fast prevents issuing a query that would silently match nothing or everything.
Solutions
- Pass a valid non-null execution ID string (a 32-char Flowable UUID, e.g. from task.getExecutionId())
- Check the ID for null before calling executionId() and take an alternate code path when absent
- Fix the upstream lookup that produced the null ID (entity not found or not refreshed)
- For broader searches, drop the executionId() restriction and filter by other criteria instead
Example fix
// before
Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult(); // throws if null
// after
String execId = task.getExecutionId();
Execution execution = execId != null
? runtimeService.createExecutionQuery().executionId(execId).singleResult()
: null; Defensive patterns
Strategy: validation
Validate before calling
Objects.requireNonNull(executionId, "executionId must not be null before querying"); query.executionId(executionId);
Type guard
boolean hasExecutionId(Task t) { return t != null && t.getExecutionId() != null; } Try / catch
try {
query.executionId(executionId);
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
throw new IllegalStateException("Cannot query execution: no execution id available", e);
} Prevention
- Never chain executionId() off a possibly-null entity lookup without checking
- Validate IDs exist after task/service calls before follow-up queries
- Distinguish 'no id' from 'id not found' in error handling
- Use Optional<String> for propagated IDs to force explicit null handling
When it happens
Trigger: Calling executionQuery.executionId(null), commonly when the execution ID variable was never populated or was returned null from a previous lookup (e.g. task.getExecutionId() on a detached entity).
Common situations: A prior Task/Execution lookup returned null and its ID was propagated; deserialized DTOs with missing id fields; REST path parameters parsed to null.
Related errors
- before time is null
- Business key is null
- Candidate group is null
- Candidate group list is null
- Candidate user is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/b15a941af16c552c.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java:470
}
@Override
public ExecutionQuery excludeProcessDefinitionKeys(Set<String> excludeProcessDefinitionKeys) {
if (excludeProcessDefinitionKeys == null) {
throw new FlowableIllegalArgumentException("Process definition keys is null");
}
if (inOrStatement) {
this.currentOrQueryObject.excludeProcessDefinitionKeys = excludeProcessDefinitionKeys;
} else {
this.excludeProcessDefinitionKeys = excludeProcessDefinitionKeys;
}
return this;
}
@Override
public ExecutionQueryImpl executionId(String executionId) {
if (executionId == null) {
throw new FlowableIllegalArgumentException("Execution id is null");
}
if (inOrStatement) {
this.currentOrQueryObject.executionId = executionId;
} else {
this.executionId = executionId;
}
return this;
}
@Override
public ExecutionQueryImpl activityId(String activityId) {
if (inOrStatement) {
this.currentOrQueryObject.activityId = activityId;
if (activityId != null) {
this.currentOrQueryObject.isActive = true;
}
} else {View on GitHub (pinned to d6d39ce1c6)