{"record":{"id":"ddebf49c6b17eea7","repo":"flowable/flowable-engine","slug":"user-or-group-are-required","errorCode":null,"errorMessage":"User or group are required.","messagePattern":"User or group are required\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceIdentityLinkCollectionResource.java","lineNumber":76,"sourceCode":"        return restResponseFactory.createRestIdentityLinks(runtimeService.getIdentityLinksForCaseInstance(caseInstance.getId()));\n    }\n\n    @ApiOperation(value = \"Add an involved user to a case instance\", tags = {\"Case Instance Identity Links\" }, nickname = \"createCaseInstanceIdentityLinks\",\n            notes = \"Note that the groupId in Response Body will always be null, as it’s only possible to involve users with a case instance.\",\n        code = 201)\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates the case instance was found and the link is created.\"),\n            @ApiResponse(code = 400, message = \"Indicates the requested body did not contain a userId or a type.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested case instance was not found.\")\n    })\n    @PostMapping(value = \"/cmmn-runtime/case-instances/{caseInstanceId}/identitylinks\", produces = \"application/json\")\n    @ResponseStatus(HttpStatus.CREATED)\n    public RestIdentityLink createIdentityLink(@ApiParam(name = \"caseInstanceId\") @PathVariable String caseInstanceId, @RequestBody RestIdentityLink identityLink) {\n\n        CaseInstance caseInstance = getCaseInstanceFromRequestWithoutAccessCheck(caseInstanceId);\n\n        if (identityLink.getGroup() == null && identityLink.getUser() == null) {\n            throw new FlowableIllegalArgumentException(\"User or group are required.\");\n        }\n        \n        if (StringUtils.isEmpty(identityLink.getGroup()) && StringUtils.isEmpty(identityLink.getUser())) {\n            throw new FlowableIllegalArgumentException(\"Only one value of user or group is supported.\");\n        }\n\n        if (identityLink.getType() == null) {\n            throw new FlowableIllegalArgumentException(\"The identity link type is required.\");\n        }\n\n        if (restApiInterceptor != null) {\n            restApiInterceptor.createCaseInstanceIdentityLink(caseInstance, identityLink);\n        }\n\n        if (StringUtils.isNotEmpty(identityLink.getGroup())) {\n            runtimeService.addGroupIdentityLink(caseInstance.getId(), identityLink.getGroup(), identityLink.getType());\n            \n        } else {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceIdentityLinkCollectionResource.java#L58-L94","documentation":"createIdentityLink requires an identity link body that carries at least a user or a group. If both RestIdentityLink.user and RestIdentityLink.group are null, FlowableIllegalArgumentException(\"User or group are required.\") is thrown. The endpoint cannot create an identity link with no identity attached.","triggerScenarios":"POST /cmmn-runtime/case-instances/{id}/identitylinks with a JSON body lacking both \"user\" and \"group\" fields (e.g. only {\"type\":\"participant\"}).","commonSituations":"Malformed request payloads; client serializing only the type field; frontend forms submitted without selecting a user or group; wrong field names in the JSON body.","solutions":["Include either \"user\" or \"group\" in the request body.","Validate the payload client-side before calling the endpoint.","Ensure field names match the RestIdentityLink schema (user, group, type).","Catch FlowableIllegalArgumentException and return a 400 to the caller with the message."],"exampleFix":"// before\n{\"type\": \"participant\"}\n// after\n{\"type\": \"participant\", \"user\": \"kermit\"}","handlingStrategy":"validation","validationCode":"// Java\nif (link.getUser() == null && link.getGroup() == null) {\n    throw new IllegalArgumentException(\"identity link requires user or group\");\n}","typeGuard":null,"tryCatchPattern":"try { restTemplate.postForEntity(identityLinksUrl, link, RestIdentityLink.class); }\ncatch (HttpClientErrorException e) { /* 400: User or group are required */ }","preventionTips":["Always send user or group in the payload","Validate forms require an identity selection","Match RestIdentityLink field names exactly"],"tags":["rest-api","identity-link","validation","missing-field"],"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-14T05:17:10.506Z"}