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 the TaskService lookup getTask(taskId) returns null. The task id was provided but no TaskEntity exists with that id in the runtime task tables, so the command cannot activate it.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ActivateTaskCmd.java:54
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();
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
- Query taskService.createTaskQuery().taskId(id).singleResult() first to confirm the task exists and is suspended
- If the task is gone, treat the activation as obsolete and skip/log rather than retry
- Verify the id against the Flowable admin UI or ACT_RU_TASK table
- Confirm you are connected to the same database/engine where the task was created
Example fix
// before
cmmnTaskService.activateTask(taskId); // may throw not-found
// after
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task != null && task.isSuspended()) {
cmmnTaskService.activateTask(taskId);
} else {
logger.info("Task {} missing or not suspended; skipping activation", taskId);
} Defensive patterns
Strategy: validation
Validate before calling
Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
if (t == null) throw new IllegalStateException("Task " + taskId + " does not exist"); Try / catch
try { cmmnTaskService.activateTask(taskId); }
catch (FlowableObjectNotFoundException e) { log.info("Task {} not found; likely already completed", taskId); } Prevention
- Query the task before activation and skip missing ones
- Purge stale task ids from work queues when cases finish
- Confirm engine/database alignment before reusing ids across environments
- Handle not-found as a benign, idempotent outcome in retry loops
When it happens
Trigger: Activating a task whose id was deleted (task completed or case terminated); using a stale id cached from a previous query; id from another engine/database (BPMN vs CMMN task tables); typo or truncated id.
Common situations: After case completion the runtime task rows are removed and old ids 404; retrying an activation job with an old id; environment mismatch (test id used against prod database).
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
- task ${taskId} doesn't exist
- Cannot resume task with id '
- Cannot find case instance for id ${caseInstanceId}
- Cannot find plan item instance for id ${planItemInstanceId}
- taskId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/242e93f051aee062.
Report an issue: GitHub.