{"record":{"id":"9384ebf0c78de064","repo":"flowable/flowable-engine","slug":"userid-and-groupid-cannot-both-be-null-9384eb","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/DeleteIdentityLinkForCaseInstanceCmd.java","lineNumber":60,"sourceCode":"        \n        validateParams(userId, groupId, caseInstanceId, type);\n        this.caseInstanceId = caseInstanceId;\n        this.userId = userId;\n        this.groupId = groupId;\n        this.type = type;\n    }\n\n    protected void validateParams(String userId, String groupId, String caseInstanceId, String type) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"caseInstanceId is null\");\n        }\n\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"type is required when deleting a process identity link\");\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        CaseInstance caseInstance = cmmnEngineConfiguration.getCaseInstanceEntityManager().findById(caseInstanceId);\n\n        if (caseInstance == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case instance with id \" + caseInstanceId, CaseInstanceEntity.class);\n        }\n\n        IdentityLinkUtil.deleteCaseInstanceIdentityLinks(caseInstance, userId, groupId, type, cmmnEngineConfiguration);\n        \n        return null;\n    }\n\n}","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseInstanceCmd.java#L42-L78","documentation":"FlowableIllegalArgumentException thrown by DeleteIdentityLinkForCaseInstanceCmd.validateParams when both userId and groupId are null. Deleting an identity link requires at least one of the two so the engine knows which link to remove. This is an argument-completeness guard.","triggerScenarios":"Calling deleteCaseInstanceIdentityLink(caseInstanceId, null, null, type) with no user and no group identified.","commonSituations":"Generic delete buttons in apps that clear both user and group fields; deserialization of an empty request body where neither field was populated; code that computed one of the two but both came back empty.","solutions":["Ensure at least one of userId or groupId is non-null before calling","If deleting all links of a type, query the identity links first and delete them individually with their user/group ids","Reject empty requests in your own API layer before reaching the engine"],"exampleFix":"// before\ncaseService.deleteCaseInstanceIdentityLink(caseInstanceId, userId, groupId, type); // both null\n// after\nif (userId == null && groupId == null) {\n    throw new IllegalArgumentException(\"Provide userId or groupId\");\n}\ncaseService.deleteCaseInstanceIdentityLink(caseInstanceId, userId, groupId, type);","handlingStrategy":"validation","validationCode":"if (userId == null && groupId == null) throw new IllegalArgumentException(\"userId or groupId required\");","typeGuard":"boolean hasSubject = userId != null || groupId != null;","tryCatchPattern":null,"preventionTips":["Treat userId/groupId as an either-or pair in your API design","Reject empty identity-link delete requests at the controller layer"],"tags":["cmmn","identity-link","null-argument","validation"],"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"}