flowable/flowable-engine · error · FlowableIllegalArgumentException

taskId is null

Error message

taskId is null

What it means

FlowableIllegalArgumentException thrown by ActivateTaskCmd.execute when taskId is null. The command activates (un-suspends) a suspended CMMN human task, but it requires a task id to look up the TaskEntity via the task service. A null id fails the guard before any lookup.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ActivateTaskCmd.java:48

import org.flowable.task.service.HistoricTaskService;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;

public class ActivateTaskCmd implements Command<Void> {

    protected String taskId;
    protected String userId;

    public ActivateTaskCmd(String taskId, String userId) {
        this.taskId = taskId;
        this.userId = userId;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        
        if (taskId == null) {
            throw new FlowableIllegalArgumentException("taskId is null");
        }

        TaskEntity task = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);

        if (task == null) {
            throw new FlowableObjectNotFoundException("Cannot find task with id " + taskId, Task.class);
        }

        if (task.isDeleted()) {
            throw new FlowableException("Task " + taskId + " is already deleted");
        }

        if (!task.isSuspended()) {
            throw new FlowableException("Task " + taskId + " is not suspended, so can't be activated");
        }
        
        Clock clock = cmmnEngineConfiguration.getClock();
        Date updateTime = clock.getCurrentTime();

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Validate taskId non-null before calling activateTask
  2. Resolve the task id from the plan item or task query instead of assuming it is set
  3. Fix the REST/controller layer to require the task id parameter
  4. Check the code path that should have populated the taskId for a null-returning call

Example fix

// before
cmmnTaskService.activateTask(taskId); // taskId may be null
// after
if (taskId == null || taskId.isBlank()) {
    throw new IllegalArgumentException("taskId is required");
}
cmmnTaskService.activateTask(taskId);
Defensive patterns

Strategy: validation

Validate before calling

if (taskId == null || taskId.isBlank()) throw new IllegalArgumentException("taskId is required");

Type guard

boolean hasTaskId(String id) { return id != null && !id.isBlank(); }

Try / catch

try { cmmnTaskService.activateTask(taskId); }
catch (FlowableIllegalArgumentException e) { log.error("Missing/invalid taskId: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling cmmnTaskService.activateTask(null) or the task service activate API with a null taskId variable; id lost when mapping from another object; REST request missing the task id.

Common situations: Batch activation scripts where some records lack task ids; wiring error in code that passes a variable intended to hold the task id but never assigned; form submission where the task id field is absent.

Related errors


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