{"record":{"id":"d58278f2f094222d","repo":"flowable/flowable-engine","slug":"userid-and-groupid-cannot-both-be-null-d58278","errorCode":null,"errorMessage":"userId and groupId cannot both be null","messagePattern":"userId and groupId cannot both be null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkForProcessDefinitionCmd.java","lineNumber":51,"sourceCode":"\n    protected String userId;\n\n    protected String groupId;\n\n    public DeleteIdentityLinkForProcessDefinitionCmd(String processDefinitionId, String userId, String groupId) {\n        validateParams(userId, groupId, processDefinitionId);\n        this.processDefinitionId = processDefinitionId;\n        this.userId = userId;\n        this.groupId = groupId;\n    }\n\n    protected void validateParams(String userId, String groupId, String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new ActivitiIllegalArgumentException(\"processDefinitionId is null\");\n        }\n\n        if (userId == null && groupId == null) {\n            throw new ActivitiIllegalArgumentException(\"userId and groupId cannot both be null\");\n        }\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ProcessDefinitionEntity processDefinition = commandContext\n                .getProcessDefinitionEntityManager()\n                .findProcessDefinitionById(processDefinitionId);\n\n        if (processDefinition == null) {\n            throw new ActivitiObjectNotFoundException(\"Cannot find process definition with id \" + processDefinitionId, ProcessDefinition.class);\n        }\n\n        processDefinition.deleteIdentityLink(userId, groupId);\n\n        return null;\n    }\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkForProcessDefinitionCmd.java#L33-L69","documentation":"When deleting an identity link from a process definition, exactly which link must be removed is determined by userId and/or groupId. If both are null, validateParams throws ActivitiIllegalArgumentException because the deletion target is undefined.","triggerScenarios":"Calling deleteProcessDefinitionIdentityLink(processDefinitionId, null, null) or the candidate-starter variants with a null identifier argument.","commonSituations":"Generic authorization-management screens where the user/group field was left empty; configuration-driven cleanup where the group name was missing from config; code copying add-identity-link validation but inverting parameter order.","solutions":["Pass the userId or groupId used when the identity link was added (addProcessDefinitionIdentityLink).","Validate at the call site that at least one identifier is present before deleting.","Log/inspect ACT_RE_PROCDEF identity links (or use repositoryService.getIdentityLinksForProcessDefinition) to find the exact stored identifier."],"exampleFix":"// before\nrepositoryService.deleteProcessDefinitionIdentityLink(defId, userId, groupId); // both null\n// after\nrepositoryService.deleteProcessDefinitionIdentityLink(defId, null, \"sales\");","handlingStrategy":"validation","validationCode":"if (userId == null && groupId == null) {\n    throw new IllegalArgumentException(\"Provide userId or groupId for process definition identity link deletion\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.deleteCandidateStarterGroup(defId, groupId);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"No identity given: {}\", e.getMessage());\n}","preventionTips":["List current links with repositoryService.getIdentityLinksForProcessDefinition(defId) to find stored identifiers","Make user/group fields mandatory in admin tooling that manages candidate starters","Keep add/delete calls symmetric: same identifier values on both sides"],"tags":["identity-link","null-argument","process-definition","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-18T16:30:33.424Z"}