flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find task with id {taskId}
Error message
Cannot find task with id {taskId} What it means
FlowableObjectNotFoundException thrown by ActivateTaskCmd.execute when no task exists with the supplied taskId. The command loads the task via the task service; a null result means the id is unknown, deleted, or belongs to another database/schema.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java:51
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();
task.setSuspendedTime(null);
task.setSuspendedBy(null);
if (task.getInProgressStartTime() != null) {
task.setState(Task.IN_PROGRESS);
} else if (task.getClaimTime() != null) {
task.setState(Task.CLAIMED);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the task exists first: taskService.createTaskQuery().taskId(id).singleResult() != null.
- Check the process instance/history to confirm the task was completed rather than deleted.
- Confirm the engine connects to the same database schema where the task was created.
- If the task was completed already, skip activation (a completed task cannot be suspended/activated).
Example fix
// before
taskService.activateTask(taskId);
// after
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task != null) {
taskService.activateTask(taskId);
} Defensive patterns
Strategy: validation
Validate before calling
Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
if (t == null) {
return; // nothing to activate
}
taskService.activateTask(taskId); Try / catch
try {
taskService.activateTask(taskId);
} catch (FlowableObjectNotFoundException e) {
// task gone (completed/deleted); skip
} Prevention
- Query the task before suspension-state changes.
- Clean up scheduled task operations when instances complete.
- Confirm schema/tenant consistency across environments.
When it happens
Trigger: taskService.activateTask(id) with an id that was never created, references a completed (and cleaned-up) task, or points at a different database/schema.
Common situations: Activating a task after the process instance was removed; multi-tenant/multi-schema setups querying the wrong schema; stale ids cached in external systems; typo'd ids from logs.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Cannot resume task with id '
- Cannot find task with id ${taskId}
- task ${taskId} doesn't exist
- taskId is null
- Cannot find task with id {taskId}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1ebc8db68cecc147.
Report an issue: GitHub.