flowable/flowable-engine · error · FlowableObjectNotFoundException
Could not find a task with id '
Error message
Could not find a task with id '
What it means
The requested CMMN task id does not correspond to any task in the engine's ACT_RU_TASK table. getTaskFromRequestWithoutAccessCheck queries taskService.createTaskQuery().taskId(taskId) and, when no task is returned, throws FlowableObjectNotFoundException typed to Task.class.
Solutions
- Verify the taskId exists via the task list query or the database before fetching
- If the task is completed, use the CMMN history task endpoints instead of runtime
- Check you are connected to the correct database/tenant where the task was created
- Catch FlowableObjectNotFoundException and return 404 to the caller
Example fix
// before
Task t = restClient.getTask("stale-or-typo-id");
// after
List<TaskResponse> found = restClient.queryTasks(taskQuery().taskId(candidateId));
if (!found.isEmpty()) { Task t = restClient.getTask(candidateId); } Defensive patterns
Strategy: try-catch
Validate before calling
const found = await queryTasks({ taskId: id }); if (found.length === 0) throw new NotFound(id); Try / catch
try { task = await getTask(id); } catch (e) { if (e.status === 404 || e instanceof FlowableObjectNotFoundException) { /* fall back to history endpoint or return 404 */ } else { throw e; } } Prevention
- Refresh task references after completion/deletion
- Use the history API for completed tasks
- Verify ids against the correct tenant/database
When it happens
Trigger: GET /cmmn-runtime/tasks/{taskId} (or any sub-resource like identity links, variables, comments) with a taskId that does not exist, was already completed/deleted, or belongs to a different engine/database.
Common situations: Stale client-side task references after task completion; wrong tenant/database; typo or truncated id; querying a historic (completed) task through the runtime API instead of the history API.
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
- Could not find task instance with id:
- Attachment with id ' ' does not have content associated…
- Cannot find process instance with id
- Cannot find process instance with id
- Cannot find task with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/f99fdba3383f3839.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskBaseResource.java:569
}
/**
* Returns the {@link Task} that is requested and calls the access interceptor.
* Throws the right exceptions when bad request was made or instance was not found.
*/
protected Task getTaskFromRequest(String taskId) {
Task task = getTaskFromRequestWithoutAccessCheck(taskId);
if (restApiInterceptor != null) {
restApiInterceptor.accessTaskInfoById(task);
}
return task;
}
protected Task getTaskFromRequestWithoutAccessCheck(String taskId) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task == null) {
throw new FlowableObjectNotFoundException("Could not find a task with id '" + taskId + "'.", Task.class);
}
return task;
}
protected List<Task> getTasksFromRequest(Collection<String> taskIds) {
return taskService.createTaskQuery().taskIds(taskIds).list();
}
}
View on GitHub (pinned to d6d39ce1c6)