flowable/flowable-engine · error · ActivitiIllegalArgumentException
executionId is null
Error message
executionId is null
What it means
HasExecutionVariableCmd.execute validates inputs and throws ActivitiIllegalArgumentException("executionId is null") when the executionId parameter is null. The command checks whether an execution has a variable, and requires both a non-null execution id and variable name. The RAISED-IN trace shows it fires during activity behavior execution, i.e. inside the process itself.
Solutions
- Null-check executionId before calling hasVariable/hasVariableLocal.
- In delegates, use DelegateExecution.getVariable/hasVariable directly instead of round-tripping through the service with an id.
- Verify the execution is persisted (execution.getId() != null) before service-based checks.
- Fix bean wiring so the executionId is populated from the delegate context, not a stale field.
Example fix
// before
boolean has = taskService.hasVariable(executionId, "approved");
// after
if (executionId == null) {
throw new IllegalArgumentException("executionId is required");
}
boolean has = taskService.hasVariable(executionId, "approved"); Defensive patterns
Strategy: validation
Validate before calling
if (executionId == null) throw new IllegalArgumentException("executionId must not be null"); Try / catch
try {
return taskService.hasVariable(executionId, variableName);
} catch (ActivitiIllegalArgumentException e) {
return false;
} Prevention
- Inside delegates/listeners use DelegateExecution.hasVariable instead of service-by-id calls.
- Ensure the execution is persisted before id-based checks.
- Do not cache executionId in beans across invocations.
When it happens
Trigger: Calling taskService.hasVariable(executionId, variableName) with null executionId, or a delegate/behavior invoking hasVariable during executionActivityBehavior with an execution that was not properly wired (null id).
Common situations: Custom JavaDelegates or ExecutionListeners calling hasVariable before the execution entity was persisted; Spring beans holding a stale/blank executionId field; tests invoking the command directly without an execution.
Related errors
- execution doesn't exist
- execution doesn't exist
- executionId is null
- planItemInstanceId is null
- planItemInstanceId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/6274f318b06c1346.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/HasExecutionVariableCmd.java:43
* @author Frederik Heremans
*/
public class HasExecutionVariableCmd implements Command<Boolean>, Serializable {
private static final long serialVersionUID = 1L;
protected String executionId;
protected String variableName;
protected boolean isLocal;
public HasExecutionVariableCmd(String executionId, String variableName, boolean isLocal) {
this.executionId = executionId;
this.variableName = variableName;
this.isLocal = isLocal;
}
@Override
public Boolean execute(CommandContext commandContext) {
if (executionId == null) {
throw new ActivitiIllegalArgumentException("executionId is null");
}
if (variableName == null) {
throw new ActivitiIllegalArgumentException("variableName is null");
}
ExecutionEntity execution = commandContext
.getExecutionEntityManager()
.findExecutionById(executionId);
if (execution == null) {
throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class);
}
boolean hasVariable = false;
if (isLocal) {
hasVariable = execution.hasVariableLocal(variableName);
} else {View on GitHub (pinned to d6d39ce1c6)