flowable/flowable-engine · error · ActivitiIllegalArgumentException

Provided activity id is null

Error message

Provided activity id is null

What it means

Thrown by EventSubscriptionQueryImpl.activityId when a null activity id is passed as a query criterion. The setter validates its argument immediately, throwing ActivitiIllegalArgumentException, so null activity filters are rejected at query construction rather than silently producing unfiltered results. This indicates the caller must supply a real activity id or omit the criterion.

Solutions

  1. Null-check the activity id and call activityId only when non-null
  2. Obtain the activity id from the correct source, e.g. execution.getCurrentActivityId() while inside an activity scope
  3. Update BPMN/config so the referenced activity id exists and is populated
  4. Build the query conditionally when activity filtering is optional

Example fix

// before
EventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery().activityId(actId);
// after
EventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery();
if (actId != null) {
    q = q.activityId(actId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (activityId == null) { throw new IllegalArgumentException("activityId must be non-null before querying"); }
query.activityId(activityId);

Type guard

boolean hasActivityId(DelegateExecution e) { return e != null && e.getCurrentActivityId() != null; }

Try / catch

try {
    query.activityId(actId);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
    // actId was null: check you are inside an activity scope or supply the id explicitly
}

Prevention

When it happens

Trigger: Calling createEventSubscriptionQuery().activityId(null), e.g. when the activity id comes from a DelegateExecution/ActivityExecution whose current activity is unavailable, or from an unset configuration value.

Common situations: Building queries inside delegates where getCurrentActivityId() returns null (e.g. outside an activity scope); activity id taken from a process variable or config key that was never populated; refactored BPMN where the target activity id was renamed/removed.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/EventSubscriptionQueryImpl.java:81

    public EventSubscriptionQueryImpl executionId(String executionId) {
        if (executionId == null) {
            throw new ActivitiIllegalArgumentException("Provided execution id is null");
        }
        this.executionId = executionId;
        return this;
    }

    public EventSubscriptionQueryImpl processInstanceId(String processInstanceId) {
        if (processInstanceId == null) {
            throw new ActivitiIllegalArgumentException("Provided process instance id is null");
        }
        this.processInstanceId = processInstanceId;
        return this;
    }

    public EventSubscriptionQueryImpl activityId(String activityId) {
        if (activityId == null) {
            throw new ActivitiIllegalArgumentException("Provided activity id is null");
        }
        this.activityId = activityId;
        return this;
    }

    public EventSubscriptionQueryImpl eventType(String eventType) {
        if (eventType == null) {
            throw new ActivitiIllegalArgumentException("Provided event type is null");
        }
        this.eventType = eventType;
        return this;
    }

    public String getTenantId() {
        return tenantId;
    }

    public EventSubscriptionQueryImpl tenantId(String tenantId) {

View on GitHub (pinned to d6d39ce1c6)