{"record":{"id":"916d8641b865a89f","repo":"flowable/flowable-engine","slug":"incompatible-usage-cannot-use-type-together-wi","errorCode":null,"errorMessage":"Incompatible usage: cannot use type '' together with a groupId","messagePattern":"Incompatible usage: cannot use type '' together with a groupId","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkCmd.java","lineNumber":62,"sourceCode":"        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 FlowableIllegalArgumentException(\"taskId is null\");\n        }\n\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"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 FlowableIllegalArgumentException(\"Incompatible usage: cannot use type '\" + type + \"' together with a groupId\");\n            }\n        } else {\n            if (userId == null && groupId == null) {\n                throw new FlowableIllegalArgumentException(\"userId and groupId cannot both be null\");\n            }\n        }\n    }\n\n    @Override\n    protected Void execute(CommandContext commandContext, TaskEntity task) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        if (IdentityLinkType.ASSIGNEE.equals(type)) {\n            TaskHelper.changeTaskAssignee(task, null, cmmnEngineConfiguration);\n        } else if (IdentityLinkType.OWNER.equals(type)) {\n            TaskHelper.changeTaskOwner(task, null, cmmnEngineConfiguration);\n        } else {\n            IdentityLinkUtil.deleteTaskIdentityLinks(task, userId, groupId, type, cmmnEngineConfiguration);\n        }","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkCmd.java#L44-L80","documentation":"DeleteIdentityLinkCmd.validateParams throws FlowableIllegalArgumentException when type is ASSIGNEE or OWNER but a groupId is also supplied. Assignee/owner links apply to a single user only, so combining them with a group is a contradictory request.","triggerScenarios":"Calling taskService.deleteTaskIdentityLink with type ASSIGNEE or OWNER and a non-null groupId, e.g. generic link-removal code that always passes both userId and groupId.","commonSituations":"Refactorings that route all identity-link deletions through one generic method and pass all parameters unconditionally; misunderstanding of which link types are group-scoped.","solutions":["Pass groupId = null when the type is ASSIGNEE or OWNER.","Use a group type (e.g. CANDIDATE) if the link to remove actually targets a group."],"exampleFix":"// before\ntaskService.deleteTaskIdentityLink(taskId, userId, groupId, IdentityLinkType.ASSIGNEE);\n// after\ntaskService.deleteTaskIdentityLink(taskId, userId, null, IdentityLinkType.ASSIGNEE);","handlingStrategy":"validation","validationCode":"if ((IdentityLinkType.ASSIGNEE.equals(type) || IdentityLinkType.OWNER.equals(type)) && groupId != null) { throw new IllegalArgumentException(\"groupId not allowed for \" + type); }","typeGuard":null,"tryCatchPattern":"try { taskService.deleteTaskIdentityLink(taskId, userId, groupId, type); } catch (FlowableIllegalArgumentException e) { log.error(\"Incompatible link parameters: {}\", e.getMessage()); }","preventionTips":["Never pass groupId with ASSIGNEE/OWNER types.","Model assignee/owner removal as user-scoped calls only."],"tags":["cmmn","identity-link","conflicting-arguments","java"],"backgroundTag":"conflicting-config-options","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"}