{"record":{"id":"cac6da5ce4195bfe","repo":"flowable/flowable-engine","slug":"task-not-found-cac6da","errorCode":null,"errorMessage":"Task '' not found","messagePattern":"Task '' not found","errorType":"exception","errorClass":"ActivitiObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedTaskFormCmd.java","lineNumber":48,"sourceCode":" */\npublic class GetRenderedTaskFormCmd implements Command<Object>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String taskId;\n    protected String formEngineName;\n\n    public GetRenderedTaskFormCmd(String taskId, String formEngineName) {\n        this.taskId = taskId;\n        this.formEngineName = formEngineName;\n    }\n\n    @Override\n    public Object execute(CommandContext commandContext) {\n        TaskEntity task = commandContext\n                .getTaskEntityManager()\n                .findTaskById(taskId);\n        if (task == null) {\n            throw new ActivitiObjectNotFoundException(\"Task '\" + taskId + \"' not found\", Task.class);\n        }\n\n        if (task.getTaskDefinition() == null) {\n            throw new ActivitiException(\"Task form definition for '\" + taskId + \"' not found\");\n        }\n\n        TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();\n        if (taskFormHandler == null) {\n            return null;\n        }\n\n        FormEngine formEngine = commandContext\n                .getProcessEngineConfiguration()\n                .getFormEngines()\n                .get(formEngineName);\n\n        if (formEngine == null) {\n            throw new ActivitiException(\"No formEngine '\" + formEngineName + \"' defined process engine configuration\");","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedTaskFormCmd.java#L30-L66","documentation":"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.","triggerScenarios":"Calling TaskService.getRenderedTaskForm(taskId) with a task id that does not exist, or that existed but was completed/deleted before the call.","commonSituations":"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.","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."],"exampleFix":"// before\ntaskService.getRenderedTaskForm(taskId); // may throw if task gone\n// after\nTask task = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (task != null) {\n    taskService.getRenderedTaskForm(taskId);\n}","handlingStrategy":"validation","validationCode":"Task task = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (task == null) throw new IllegalArgumentException(\"Unknown task: \" + taskId);","typeGuard":null,"tryCatchPattern":"try {\n    taskService.getRenderedTaskForm(taskId);\n} catch (ActivitiObjectNotFoundException e) {\n    // task completed/deleted — refresh task list\n}","preventionTips":["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"],"tags":["task","not-found","workflow","form-service"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}