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
- Validate taskId non-null before calling activateTask
- Resolve the task id from the plan item or task query instead of assuming it is set
- Fix the REST/controller layer to require the task id parameter
- 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
- Validate ids at the service entry point
- Do not propagate nullable ids from DTOs into engine calls
- Derive task ids from task queries rather than assumed variables
- Enforce required path/query parameters in the REST layer
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
- taskId is null
- variableName is null
- Case instance id is null
- Plan item instance id is null
- Cannot find task with id ${taskId}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5a2ef44244224da8.
Report an issue: GitHub.