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

id is empty

Error message

id is empty

What it means

InternalVariableInstanceQuery.id() throws FlowableIllegalArgumentException when the id argument is null or an empty string (StringUtils.isEmpty). A variable instance query by id is meaningless without an identifier, so the empty case is rejected up front instead of yielding an empty or malformed database query.

Solutions

  1. Pass a valid non-empty variable instance id string.
  2. Check StringUtils.isNotBlank(id) before invoking the query and handle the missing-id case in your code.
  3. If ids are resolved dynamically, verify the lookup succeeded before building the query.
  4. If querying by something other than id is intended, use the appropriate filter (name, taskId, executionId) instead.

Example fix

// before
internalQuery.id(variableInstanceId);

// after
if (variableInstanceId != null && !variableInstanceId.isEmpty()) {
    internalQuery.id(variableInstanceId);
} else {
    throw new IllegalArgumentException("variableInstanceId is required");
}
Defensive patterns

Strategy: validation

Validate before calling

if (id == null || id.trim().isEmpty()) {
    throw new IllegalArgumentException("variable instance id is required");
}

Try / catch

try {
    internalQuery.id(id);
} catch (FlowableIllegalArgumentException e) {
    throw new IllegalStateException("Missing variable instance id for query", e);
}

Prevention

When it happens

Trigger: Calling internalVariableInstanceQuery.id(null) or id("") — typically an id variable that was never set, or an id stripped to empty by trimming/parsing.

Common situations: An id passed as a method parameter from an upstream layer where it was optional; deserialization of a payload missing the id field; string manipulation (e.g. substring/split) accidentally producing an empty id.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java:59

    protected Collection<String> taskIds;
    protected String processInstanceId;
    protected String executionId;
    protected Collection<String> executionIds;
    protected boolean withoutTaskId;
    protected String scopeId;
    protected Collection<String> scopeIds;
    protected String subScopeId;
    protected Collection<String> subScopeIds;
    protected boolean withoutSubScopeId;
    protected String scopeType;
    protected Collection<String> scopeTypes;
    protected String name;
    protected Collection<String> names;

    @Override
    public InternalVariableInstanceQuery id(String id) {
        if (StringUtils.isEmpty(id)) {
            throw new FlowableIllegalArgumentException("id is empty");
        }
        this.id = id;
        return this;
    }

    @Override
    public InternalVariableInstanceQuery taskId(String taskId) {
        if (StringUtils.isEmpty(taskId)) {
            throw new FlowableIllegalArgumentException("taskId is empty");
        }

        if (withoutTaskId) {
            throw new FlowableIllegalArgumentException("Cannot combine taskId(String) with withoutTaskId() in the same query");
        }

        this.taskId = taskId;
        return this;
    }

View on GitHub (pinned to d6d39ce1c6)