{"record":{"id":"738f60cf2c02ada8","repo":"flowable/flowable-engine","slug":"userid-and-groupid-cannot-both-be-null-738f60","errorCode":null,"errorMessage":"userId and groupId cannot both be null","messagePattern":"userId and groupId cannot both be null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseDefinitionCmd.java","lineNumber":54,"sourceCode":"\n    protected String userId;\n\n    protected String groupId;\n\n    public DeleteIdentityLinkForCaseDefinitionCmd(String caseDefinitionId, String userId, String groupId) {\n        validateParams(userId, groupId, caseDefinitionId);\n        this.caseDefinitionId = caseDefinitionId;\n        this.userId = userId;\n        this.groupId = groupId;\n    }\n\n    protected void validateParams(String userId, String groupId, String caseDefinitionId) {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"caseDefinitionId is null\");\n        }\n\n        if (userId == null && groupId == null) {\n            throw new FlowableIllegalArgumentException(\"userId and groupId cannot both be null\");\n        }\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);\n\n        if (caseDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case definition with id \" + caseDefinitionId, CaseDefinition.class);\n        }\n\n        cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()\n            .deleteScopeDefinitionIdentityLink(caseDefinition.getId(), ScopeTypes.CMMN, userId, groupId);\n\n        return null;\n    }\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseDefinitionCmd.java#L36-L72","documentation":"DeleteIdentityLinkForCaseDefinitionCmd.validateParams throws FlowableIllegalArgumentException when both userId and groupId are null. Even with a valid caseDefinitionId, at least one identity must be given to select the link row to delete.","triggerScenarios":"Calling deleteUserIdentityLink/deleteGroupIdentityLinkForCaseDefinition with both identity arguments null, e.g. optional parameters forwarded unchanged from an API layer.","commonSituations":"Admin screens with two optional fields (user/group) submitted empty; scripts parameterized with empty values.","solutions":["Supply the userId or groupId that was originally added via addUserIdentityLink/addGroupIdentityLinkForCaseDefinition.","Validate that exactly one identity is set before calling the API."],"exampleFix":"// before\nrepositoryService.deleteUserIdentityLinkForCaseDefinition(defId, null, null);\n// after\nif (userId == null && groupId == null) throw new IllegalArgumentException(\"userId or groupId required\");\nrepositoryService.deleteUserIdentityLinkForCaseDefinition(defId, userId, groupId);","handlingStrategy":"validation","validationCode":"if (userId == null && groupId == null) throw new IllegalArgumentException(\"userId or groupId required\");","typeGuard":null,"tryCatchPattern":"try { repositoryService.deleteUserIdentityLinkForCaseDefinition(defId, userId, type); } catch (FlowableIllegalArgumentException e) { log.error(\"Must supply userId or groupId\"); }","preventionTips":["Make user or group mandatory in admin UIs/forms.","Mirror the engine's validation in your own DTO validation."],"tags":["cmmn","identity-link","validation","java"],"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-14T11:17:12.474Z"}