flowable/flowable-engine · error · ActivitiIllegalArgumentException

Execution id is null

Error message

Execution id is null

What it means

ExecutionQueryImpl.executionId throws ActivitiIllegalArgumentException when the executionId argument is null. The query builder validates each criterion eagerly, so a null id fails immediately at query-construction time rather than at database execution time.

Solutions

  1. Resolve a valid execution id before constructing the query
  2. Skip the executionId criterion if filtering by it is not intended
  3. Return a clearer domain error at the call site when the id is required but missing

Example fix

// before
Execution e = runtimeService.createExecutionQuery().executionId(execId).singleResult();
// after
Objects.requireNonNull(execId, "execId is required");
Execution e = runtimeService.createExecutionQuery().executionId(execId).singleResult();
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(executionId, "executionId required");

Type guard

boolean hasExecId = executionId != null && !executionId.isEmpty();

Try / catch

try { q.executionId(execId); } catch (ActivitiIllegalArgumentException e) { throw new BadRequestException(e.getMessage(), e); }

Prevention

When it happens

Trigger: Calling query.executionId(id) with a null id, usually a variable that was supposed to hold a resolved execution identifier from a prior API result.

Common situations: Chaining service calls where an earlier task/execution lookup returned null; message correlation handlers that receive no execution id; refactors introducing a nullable id field.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java:184

            this.businessKey = processInstanceBusinessKey;
            this.includeChildExecutionsWithBusinessKeyQuery = includeChildExecutions;
            return this;
        }
    }

    @Override
    public ExecutionQuery processDefinitionKeys(Set<String> processDefinitionKeys) {
        if (processDefinitionKeys == null) {
            throw new ActivitiIllegalArgumentException("Process definition keys is null");
        }
        this.processDefinitionKeys = processDefinitionKeys;
        return this;
    }

    @Override
    public ExecutionQueryImpl executionId(String executionId) {
        if (executionId == null) {
            throw new ActivitiIllegalArgumentException("Execution id is null");
        }
        this.executionId = executionId;
        return this;
    }

    @Override
    public ExecutionQueryImpl activityId(String activityId) {
        this.activityId = activityId;

        if (activityId != null) {
            isActive = true;
        }
        return this;
    }

    @Override
    public ExecutionQueryImpl parentId(String parentId) {
        if (parentId == null) {

View on GitHub (pinned to d6d39ce1c6)