{"record":{"id":"f2ae391f9f77a3dd","repo":"flowable/flowable-engine","slug":"taskid-is-null-f2ae39","errorCode":null,"errorMessage":"taskId is null","messagePattern":"taskId is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkCmd.java","lineNumber":47,"sourceCode":"\n    protected String userId;\n\n    protected String groupId;\n\n    protected String type;\n\n    public DeleteIdentityLinkCmd(String taskId, String userId, String groupId, String type) {\n        super(taskId);\n        validateParams(userId, groupId, type, taskId);\n        this.taskId = taskId;\n        this.userId = userId;\n        this.groupId = groupId;\n        this.type = type;\n    }\n\n    protected void validateParams(String userId, String groupId, String type, String taskId) {\n        if (taskId == null) {\n            throw new ActivitiIllegalArgumentException(\"taskId is null\");\n        }\n\n        if (type == null) {\n            throw new ActivitiIllegalArgumentException(\"type is required when adding a new task identity link\");\n        }\n\n        // Special treatment for assignee and owner: group cannot be used and userId may be null\n        if (IdentityLinkType.ASSIGNEE.equals(type) || IdentityLinkType.OWNER.equals(type)) {\n            if (groupId != null) {\n                throw new ActivitiIllegalArgumentException(\"Incompatible usage: cannot use type '\" + type\n                        + \"' together with a groupId\");\n            }\n        } else {\n            if (userId == null && groupId == null) {\n                throw new ActivitiIllegalArgumentException(\"userId and groupId cannot both be null\");\n            }\n        }\n    }","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkCmd.java#L29-L65","documentation":"DeleteIdentityLinkCmd removes an identity link (user/group association) from a task, and validateParams rejects a null taskId up front with ActivitiIllegalArgumentException. Identity links are always task-scoped in this command, so the task id is mandatory.","triggerScenarios":"Calling taskService.deleteUserIdentityLink / deleteGroupIdentityLink (this command) with a null taskId, usually from an unset variable or a wrong method overload.","commonSituations":"Cleanup code that removes assignments where the task id was never captured; passing a processInstanceId instead of a taskId variable slot; integration code mapping external user data with missing task references.","solutions":["Pass the id of the task whose identity link is being removed (task.getId()).","Guard the call site: skip when taskId is null.","Verify you are not accidentally using the process-definition identity link command with task-shaped arguments."],"exampleFix":"// before\ntaskService.deleteUserIdentityLink(taskId, userId, IdentityLinkType.ASSIGNEE);\n// after\nif (taskId != null) {\n    taskService.deleteUserIdentityLink(taskId, userId, IdentityLinkType.ASSIGNEE);\n}","handlingStrategy":"validation","validationCode":"if (taskId == null) {\n    throw new IllegalArgumentException(\"taskId required to delete an identity link\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskService.deleteUserIdentityLink(taskId, userId, type);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Invalid identity-link delete request: {}\", e.getMessage());\n}","preventionTips":["Keep taskId captured together with identity-link metadata when you add the link","Use the task entity's getId() at the call site","Unit-test delete paths with realistic (non-null) ids"],"tags":["null-argument","identity-link","task","validation"],"backgroundTag":"null-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"}