{"record":{"id":"331f444f10f4ba92","repo":"flowable/flowable-engine","slug":"task-331f44","errorCode":null,"errorMessage":"Task '","messagePattern":"Task '","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetRenderedTaskFormCmd.java","lineNumber":57,"sourceCode":"    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\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"Task id should not be null\");\n        }\n\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"Task '\" + taskId + \"' not found\", Task.class);\n        }\n\n        FormHandlerHelper formHandlerHelper = processEngineConfiguration.getFormHandlerHelper();\n        TaskFormHandler taskFormHandler = formHandlerHelper.getTaskFormHandlder(task);\n        if (taskFormHandler != null) {\n\n            FormEngine formEngine = processEngineConfiguration.getFormEngines().get(formEngineName);\n\n            if (formEngine == null) {\n                throw new FlowableException(\"No formEngine '\" + formEngineName + \"' defined process engine configuration\");\n            }\n\n            TaskFormData taskForm = taskFormHandler.createTaskForm(task);\n\n            return formEngine.renderTaskForm(taskForm);\n        }\n\n        return null;","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetRenderedTaskFormCmd.java#L39-L75","documentation":"FlowableObjectNotFoundException thrown by GetRenderedTaskFormCmd.execute when no task exists for the given taskId. The task service lookup returns null, so the command reports \"Task '<id>' not found\" with Task.class as the resource type. This differs from the null-id error: a real id was supplied but it does not match any persisted task.","triggerScenarios":"Calling formService.getRenderedTaskForm(taskId) with an id that is not in the task tables — already completed/deleted task, wrong database, id from a different engine instance, or a fabricated/garbage id.","commonSituations":"User renders a form for a task that was completed by someone else meanwhile (race condition); stale task ids cached in a web session; multi-tenant setup querying the wrong tenant; standalone app pointing at a different database than the workflow engine.","solutions":["Check task existence first with taskService.createTaskQuery().taskId(id).singleResult() and handle null in the UI.","Reload the task list after task completion to avoid stale ids in the session/UI.","Verify database and tenant configuration of the engine instance.","Catch FlowableObjectNotFoundException around the call and show a 'task no longer available' message instead of a stack trace."],"exampleFix":"// before\nObject form = formService.getRenderedTaskForm(taskId); // may throw if stale\n// after\nTask task = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (task == null) {\n    return formUnavailable();\n}\nObject form = formService.getRenderedTaskForm(taskId);","handlingStrategy":"try-catch","validationCode":"Task task = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (task == null) { /* task gone: completed, deleted, or wrong db/tenant */ return null; }","typeGuard":null,"tryCatchPattern":"try {\n    return formService.getRenderedTaskForm(taskId);\n} catch (FlowableObjectNotFoundException e) {\n    // refresh the user's task list; treat as 404\n}","preventionTips":["Re-query the task list after task operations instead of trusting cached ids.","Handle optimistic-concurrency style races (task completed by another user) gracefully in the UI.","Confirm tenant and database configuration when ids consistently go missing.","Validate task ids came from the same engine/database that serves the form request."],"tags":["task","not-found","forms","flowable"],"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-18T11:17:12.947Z"}