flowable/flowable-engine · error · FlowableIllegalArgumentException

eventId is null

Error message

eventId is null

What it means

GetTaskEventCmd looks up a single task/event record (e.g. a comment event) by eventId. The constructor validates immediately and throws FlowableIllegalArgumentException if eventId is null, because event lookup requires an identifier.

Solutions

  1. Only call getEvent with an id previously returned by getTaskEvents/getProcessInstanceComments or an Event object's getId()
  2. Null-check eventId in caller code before invoking the API
  3. If events may not exist, list events first (taskService.getTaskEvents(taskId)) and read ids from results

Example fix

// before
Event event = taskService.getEvent(eventId); // eventId null
// after
if (eventId != null) {
    Event event = taskService.getEvent(eventId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (eventId == null) {
    throw new IllegalArgumentException("eventId is required");
}

Type guard

boolean hasEventId(String id) {
    return id != null && !id.trim().isEmpty();
}

Try / catch

try {
    Event event = taskService.getEvent(eventId);
} catch (FlowableIllegalArgumentException e) {
    log.warn("getEvent called with null eventId", e);
}

Prevention

When it happens

Trigger: Calling taskService.getEvent(eventId) or taskService.getTaskEvent(eventId) with a null eventId, or constructing new GetTaskEventCmd(null).

Common situations: Event id sourced from a process variable or request parameter that is absent; calling getEvent on an engine where events/comments were not recorded so no id was ever captured.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskEventCmd.java:36

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.engine.task.Event;

/**
 * @author Frederik Heremans
 */
public class GetTaskEventCmd implements Command<Event>, Serializable {

    private static final long serialVersionUID = 1L;
    protected String eventId;

    public GetTaskEventCmd(String eventId) {
        this.eventId = eventId;

        if (eventId == null) {
            throw new FlowableIllegalArgumentException("eventId is null");
        }
    }

    @Override
    public Event execute(CommandContext commandContext) {
        return CommandContextUtil.getCommentEntityManager(commandContext).findEvent(eventId);
    }
}

View on GitHub (pinned to d6d39ce1c6)