flowable/flowable-engine · error · org.flowable.common.engine.api.FlowableIllegalArgumentException

Execution id is null

Error message

Execution id is null

What it means

HistoricVariableInstanceQueryImpl.executionId requires a non-null execution id and also rejects being combined with excludeLocalVariables. Passing null throws this FlowableIllegalArgumentException before the query is executed. This keeps invalid queries from producing undefined result sets.

Solutions

  1. Check the execution id for null and skip the clause when absent
  2. Fetch the id from a reliable source (DelegateExecution.getId()) before querying
  3. Do not call excludeLocalVariables together with executionId; choose one constraint
  4. Use processInstanceId instead when the execution id is unavailable

Example fix

// before
query.executionId(executionId).excludeLocalVariables();
// after
if (executionId != null) {
    query.executionId(executionId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (executionId == null || executionId.isBlank()) {
    throw new IllegalArgumentException("executionId required for this query");
}
query.executionId(executionId); // and do NOT also call excludeLocalVariables

Type guard

static boolean hasExecutionId(String eid) {
    return eid != null && !eid.isBlank();
}

Try / catch

try {
    query.executionId(eid);
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
    // fall back to processInstanceId or skip the query
}

Prevention

When it happens

Trigger: Calling createHistoricVariableInstanceQuery().executionId(null), e.g. when the execution id is taken from a nullable variable or an execution that was not started; also indirectly when excludeLocalVariables is set first with a null id.

Common situations: Delegates or listeners run outside a normal execution context returning null ids; optional path parameters; API changes where executionId became optional but the call site was not updated.

Related errors


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

Appendix: source

Thrown at modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/HistoricVariableInstanceQueryImpl.java:101

            throw new FlowableIllegalArgumentException("processInstanceId is null");
        }
        this.processInstanceId = processInstanceId;
        return this;
    }

    @Override
    public HistoricVariableInstanceQuery processInstanceIds(Collection<String> processInstanceIds) {
        if (processInstanceIds == null || processInstanceIds.isEmpty()) {
            throw new FlowableIllegalArgumentException("processInstanceIds is empty");
        }
        this.processInstanceIds = processInstanceIds;
        return this;
    }

    @Override
    public HistoricVariableInstanceQueryImpl executionId(String executionId) {
        if (executionId == null) {
            throw new FlowableIllegalArgumentException("Execution id is null");
        }
        if (excludeLocalVariables) {
            throw new FlowableIllegalArgumentException("Cannot use executionId together with excludeLocalVariables");
        }
        this.executionId = executionId;
        return this;
    }

    @Override
    public HistoricVariableInstanceQueryImpl executionIds(Set<String> executionIds) {
        if (executionIds == null) {
            throw new FlowableIllegalArgumentException("executionIds is null");
        }
        if (executionIds.isEmpty()) {
            throw new FlowableIllegalArgumentException("Set of executionIds is empty");
        }
        if (excludeLocalVariables) {
            throw new FlowableIllegalArgumentException("Cannot use executionIds together with excludeLocalVariables");

View on GitHub (pinned to d6d39ce1c6)