flowable/flowable-engine · error · ActivitiObjectNotFoundException
Task '' not found
Error message
Task '' not found
What it means
Lookup failure in flowable5 GetRenderedTaskFormCmd.execute: no task entity exists with the given taskId, so its rendered form cannot be produced; indicates an unknown or already-completed/deleted task.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedTaskFormCmd.java:48
*/
public class GetRenderedTaskFormCmd implements Command<Object>, Serializable {
private static final long serialVersionUID = 1L;
protected String taskId;
protected String formEngineName;
public GetRenderedTaskFormCmd(String taskId, String formEngineName) {
this.taskId = taskId;
this.formEngineName = formEngineName;
}
@Override
public Object execute(CommandContext commandContext) {
TaskEntity task = commandContext
.getTaskEntityManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiObjectNotFoundException("Task '" + taskId + "' not found", Task.class);
}
if (task.getTaskDefinition() == null) {
throw new ActivitiException("Task form definition for '" + taskId + "' not found");
}
TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
if (taskFormHandler == null) {
return null;
}
FormEngine formEngine = commandContext
.getProcessEngineConfiguration()
.getFormEngines()
.get(formEngineName);
if (formEngine == null) {
throw new ActivitiException("No formEngine '" + formEngineName + "' defined process engine configuration");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Confirm the task exists: taskService.createTaskQuery().taskId(taskId).singleResult() before rendering.
- Re-fetch the current task id for the user/execution via taskService.createTaskQuery().taskCandidateOrAssigned(userId).list().
- Handle the completed/deleted case in the UI by refreshing the task list instead of retrying the stale id.
- Verify you are querying the same engine/database the task belongs to.
Example fix
// before
taskService.getRenderedTaskForm(taskId); // may throw if task gone
// after
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task != null) {
taskService.getRenderedTaskForm(taskId);
} Defensive patterns
Strategy: validation
Validate before calling
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task == null) throw new IllegalArgumentException("Unknown task: " + taskId); Try / catch
try {
taskService.getRenderedTaskForm(taskId);
} catch (ActivitiObjectNotFoundException e) {
// task completed/deleted — refresh task list
} Prevention
- Re-query tasks before acting on ids held by long-lived UI sessions
- Account for tasks disappearing via completion, delegation removal, or instance deletion
- Never hard-code task ids across environments
When it happens
Trigger: Calling TaskService.getRenderedTaskForm(taskId) with a task id that does not exist, or that existed but was completed/deleted before the call.
Common situations: Stale task id from a UI after the task was completed by another user or a job; hard-coded ids; calling across engines/environments (test id used against production engine); task removed by process instance deletion.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Process Definition '' not found
- No task found for taskId ''
- Cannot resume task with id '
- Cannot find task with id ${taskId}
- task ${taskId} doesn't exist
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/cac6da5ce4195bfe.
Report an issue: GitHub.