{"record":{"id":"b0e90676040d8532","repo":"flowable/flowable-engine","slug":"no-taskformhandler-specified-for-task","errorCode":null,"errorMessage":"No taskFormHandler specified for task ''","messagePattern":"No taskFormHandler specified for task ''","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetTaskFormCmd.java","lineNumber":51,"sourceCode":"    protected String taskId;\n\n    public GetTaskFormCmd(String taskId) {\n        this.taskId = taskId;\n    }\n\n    @Override\n    public TaskFormData execute(CommandContext commandContext) {\n        TaskEntity task = commandContext\n                .getTaskEntityManager()\n                .findTaskById(taskId);\n        if (task == null) {\n            throw new ActivitiObjectNotFoundException(\"No task found for taskId '\" + taskId + \"'\", Task.class);\n        }\n\n        if (task.getTaskDefinition() != null) {\n            TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();\n            if (taskFormHandler == null) {\n                throw new ActivitiException(\"No taskFormHandler specified for task '\" + taskId + \"'\");\n            }\n\n            return taskFormHandler.createTaskForm(task);\n        } else {\n            // Standalone task, no TaskFormData available\n            return null;\n        }\n    }\n\n}\n","sourceCodeStart":33,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetTaskFormCmd.java#L33-L62","documentation":"After the task is found, GetTaskFormCmd asks the task definition for its TaskFormHandler. If the definition has no form handler configured, the command throws ActivitiException. This is a process-model configuration defect rather than a runtime data problem: no form key/handler was defined for the user task.","triggerScenarios":"Calling taskService.getTaskForm(taskId) for a task whose BPMN user task has no flowable:formKey/activiti:form attribute and no custom TaskFormHandler registered, while the task definition exists (getTaskDefinition() != null).","commonSituations":"Deployed BPMN XML where the user task lacks a formKey but the UI still requests a form; custom form-handling extension removed or not registered; mixing engine versions where form handling wiring changed.","solutions":["Add a form key to the user task in the BPMN model (flowable:formKey=\"...\") and redeploy.","Register a custom TaskFormHandler/TaskFormHandlerFactory on the process engine configuration if you handle forms programmatically.","If the task is standalone and has no form, treat null (standalone branch) instead of calling getTaskForm for tasks without definitions with forms.","Audit deployed process definitions for user tasks missing formKey attributes before enabling the task form UI."],"exampleFix":"// before\n<userTask id=\"approve\" name=\"Approve\" />\n// after\n<userTask id=\"approve\" name=\"Approve\" flowable:formKey=\"approveForm\" />","handlingStrategy":"fallback","validationCode":"Task task = taskService.createTaskQuery().taskId(taskId).singleResult();\n// cannot inspect formHandler from public API; validate formKey presence in the deployed model instead\nboolean modelHasForm = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(task.getProcessDefinitionId()).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    return taskService.getTaskForm(taskId);\n} catch (ActivitiException e) {\n    if (e.getMessage().startsWith(\"No taskFormHandler\")) return renderDefaultForm();\n    throw e;\n}","preventionTips":["Lint deployed BPMN models for user tasks missing flowable:formKey before deployment.","Keep custom TaskFormHandler registration in a shared engine configuration module.","Test the full form flow (start to form render) for every new user task."],"tags":["task","form","configuration","bpmn"],"backgroundTag":"missing-required-config","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"}