flowable/flowable-engine · error · FlowableIllegalArgumentException
taskId is null
Error message
taskId is null
What it means
FlowableIllegalArgumentException thrown by ActivateTaskCmd.execute when the taskId constructor argument is null. The command cannot look up a task without an id, so it fails fast before touching the database.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java:45
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) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
if (taskId == null) {
throw new FlowableIllegalArgumentException("taskId is null");
}
TaskEntity task = processEngineConfiguration.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 + " is already deleted");
}
if (!task.isSuspended()) {
throw new FlowableException(task + " is not suspended, so can't be activated");
}
Clock clock = processEngineConfiguration.getClock();
Date updateTime = clock.getCurrentTime();View on GitHub (pinned to d6d39ce1c6)
Solutions
- Ensure taskId is non-null before calling taskService.activateTask(taskId).
- Check the source of the id: if it comes from Task.getId(), verify the task was actually created/queried successfully.
- Guard the call site with an explicit null check or Objects.requireNonNull to fail earlier with a clearer message.
- Fix upstream logic that returns null ids (e.g. singleResult() on an empty query).
Example fix
// before
taskService.activateTask(taskId); // taskId may be null
// after
if (taskId == null) {
throw new IllegalArgumentException("taskId must be provided");
}
taskService.activateTask(taskId); Defensive patterns
Strategy: validation
Validate before calling
java.util.Objects.requireNonNull(taskId, "taskId must not be null"); taskService.activateTask(taskId);
Prevention
- Validate taskId at API boundaries before invoking commands.
- Ensure upstream queries return non-null ids (check singleResult() results).
- Avoid flowing Optional.empty()/null ids into task operations.
When it happens
Trigger: Calling taskService.activateTask(null) or constructing new ActivateTaskCmd(null); passing a variable that was never populated to taskService.activateTask(...).
Common situations: A null taskId returned from a lookup chain (e.g. taskQuery found nothing and the id variable defaulted to null); programmatic suspension helpers fed null after an earlier failed query.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5dc2cd69b83107ac.
Report an issue: GitHub.