{"record":{"id":"58d4c2d7b04f9503","repo":"flowable/flowable-engine","slug":"an-assignee-is-required-when-delegating-a-task-58d4c2","errorCode":null,"errorMessage":"An assignee is required when delegating a task.","messagePattern":"An assignee is required when delegating a task\\.","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskResource.java","lineNumber":246,"sourceCode":"                }\n            }\n\n        }\n\n        taskCompletionBuilder\n                .taskId(task.getId())\n                .formDefinitionId(actionRequest.getFormDefinitionId())\n                .outcome(actionRequest.getOutcome())\n                .complete();\n    }\n\n    protected void resolveTask(Task task, TaskActionRequest actionRequest) {\n        taskService.resolveTask(task.getId());\n    }\n\n    protected void delegateTask(Task task, TaskActionRequest actionRequest) {\n        if (actionRequest.getAssignee() == null) {\n            throw new FlowableIllegalArgumentException(\"An assignee is required when delegating a task.\");\n        }\n        taskService.delegateTask(task.getId(), actionRequest.getAssignee());\n    }\n\n    protected void claimTask(Task task, TaskActionRequest actionRequest) {\n        // In case the task is already claimed, a\n        // FlowableTaskAlreadyClaimedException is thrown and converted to\n        // a CONFLICT response by the ExceptionHandlerAdvice\n        taskService.claim(task.getId(), actionRequest.getAssignee());\n    }\n\n    protected void unclaimTask(Task task) {\n        taskService.unclaim(task.getId());\n    }\n}\n","sourceCodeStart":228,"sourceCodeEnd":262,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskResource.java#L228-L262","documentation":"FlowableIllegalArgumentException thrown by TaskResource.delegateTask when action=delegate is requested without an assignee. Delegation in Flowable requires a target user to delegate to; the engine API delegateTask(taskId, userId) cannot be invoked with null.","triggerScenarios":"POST /runtime/tasks/{taskId}/action with {\"action\":\"delegate\"} and no assignee field (or assignee: null) in the body.","commonSituations":"Copy-pasting a claim/complete request and changing only the action field; forgetting that delegate, unlike claim/complete, mandates an assignee.","solutions":["Add \"assignee\":\"<userId>\" to the task action request body","Verify the action verb: resolve/complete do not require assignee, delegate does","Guard client-side: only send action=delegate after the assignee value is confirmed non-null"],"exampleFix":"// before\n{\"action\":\"delegate\"}\n// after\n{\"action\":\"delegate\",\"assignee\":\"kermit\"}","handlingStrategy":"validation","validationCode":"if (action.equals(\"delegate\") && (assignee == null || assignee.isEmpty())) throw new IllegalArgumentException(\"assignee required for delegate\");","typeGuard":null,"tryCatchPattern":"try { delegate(taskId, assignee) } catch (FlowableIllegalArgumentException e) { promptUserForAssignee(); }","preventionTips":["Require assignee in any UI/workflow step that selects the delegate action","Model each action's required fields in your client DTO validation","Remember: claim and resolve differ from delegate in required fields"],"tags":["rest-api","validation","task-delegation"],"backgroundTag":"missing-required-argument","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"}