flowable/flowable-engine · error · FlowableObjectNotFoundException
No task found for taskId '
Error message
No task found for taskId '
What it means
GetTaskFormCmd builds the TaskFormData for a task. It first loads the TaskEntity by taskId; if TaskService returns null it throws FlowableObjectNotFoundException("No task found for taskId '<id>'", Task.class), i.e. the id is syntactically fine but no such task exists.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormCmd.java:50
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class GetTaskFormCmd implements Command<TaskFormData>, Serializable {
private static final long serialVersionUID = 1L;
protected String taskId;
public GetTaskFormCmd(String taskId) {
this.taskId = taskId;
}
@Override
public TaskFormData execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);
if (task == null) {
throw new FlowableObjectNotFoundException("No task found for taskId '" + taskId + "'", Task.class);
}
if (task.getProcessDefinitionId() != null && Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, task.getProcessDefinitionId())) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
return compatibilityHandler.getTaskFormData(taskId);
}
FormHandlerHelper formHandlerHelper = processEngineConfiguration.getFormHandlerHelper();
TaskFormHandler taskFormHandler = formHandlerHelper.getTaskFormHandlder(task);
if (taskFormHandler == null) {
throw new FlowableException("No taskFormHandler specified for '" + task + "'");
}
return taskFormHandler.createTaskForm(task);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the task exists via taskService.createTaskQuery().taskId(taskId).singleResult() before requesting its form
- Catch FlowableObjectNotFoundException and redirect the user to a task list / 'task no longer available' page
- Confirm you are querying the same engine/database that owns the task
- Check history cleanup policies if tasks are purged shortly after completion
Example fix
// before
TaskFormData form = taskService.getTaskForm(taskId); // throws if gone
// after
if (taskService.createTaskQuery().taskId(taskId).count() > 0) {
TaskFormData form = taskService.getTaskForm(taskId);
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean exists = taskService.createTaskQuery().taskId(taskId).count() > 0;
Type guard
boolean taskExists(String taskId) {
return taskId != null
&& taskService.createTaskQuery().taskId(taskId).count() > 0;
} Try / catch
try {
TaskFormData form = taskService.getTaskForm(taskId);
} catch (FlowableObjectNotFoundException e) {
// task gone; redirect user to task list
form = null;
} Prevention
- Re-verify task existence before rendering forms from links/emails
- Handle completed-and-purged tasks gracefully in UI flows
When it happens
Trigger: Calling taskService.getTaskForm(taskId) with an unknown, deleted, or wrong-environment taskId.
Common situations: Form rendered from a stale/deep link after the task was completed and purged; ids copied between dev/test databases; multi-tenant setup querying the wrong engine.
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
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3a2dcbcde23c2d99.
Report an issue: GitHub.