{"record":{"id":"73868f5bde75406c","repo":"flowable/flowable-engine","slug":"user-or-group-are-required-73868f","errorCode":null,"errorMessage":"User or group are required.","messagePattern":"User or group are required\\.","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ProcessInstanceIdentityLinkCollectionResource.java","lineNumber":76,"sourceCode":"        return restResponseFactory.createRestIdentityLinks(runtimeService.getIdentityLinksForProcessInstance(processInstance.getId()));\n    }\n\n    @ApiOperation(value = \"Add an involved user to a process instance\", tags = {\"Process Instance Identity Links\" }, nickname = \"createProcessInstanceIdentityLinks\",\n            notes = \"Note that the groupId in Response Body will always be null, as it’s only possible to involve users with a process-instance.\",\n            code = 201)\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates the process 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 process instance was not found.\")\n    })\n    @PostMapping(value = \"/runtime/process-instances/{processInstanceId}/identitylinks\", produces = \"application/json\")\n    @ResponseStatus(HttpStatus.CREATED)\n    public RestIdentityLink createIdentityLink(@ApiParam(name = \"processInstanceId\") @PathVariable String processInstanceId, @RequestBody RestIdentityLink identityLink) {\n\n        ProcessInstance processInstance = getProcessInstanceFromRequestWithoutAccessCheck(processInstanceId);\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.createProcessInstanceIdentityLink(processInstance, identityLink);\n        }\n\n        if (StringUtils.isNotEmpty(identityLink.getGroup())) {\n            runtimeService.addGroupIdentityLink(processInstance.getId(), identityLink.getGroup(), identityLink.getType());\n            \n        } else {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ProcessInstanceIdentityLinkCollectionResource.java#L58-L94","documentation":"To create an identity link on a running process instance, the request body must reference either a user or a group. If both the user and group fields are null, createIdentityLink throws FlowableIllegalArgumentException('User or group are required.') because there is nothing to link.","triggerScenarios":"POST /runtime/process-instances/{processInstanceId}/identitylinks with a body like {\"type\":\"participant\"} — no \"user\" and no \"group\" set. Thrown at ProcessInstanceIdentityLinkCollectionResource.java:76.","commonSituations":"Building the RestIdentityLink body but forgetting to set either field; JSON keys misspelled (e.g. \"username\" instead of \"user\"); serializers dropping empty strings/names so both fields arrive null.","solutions":["Set either \"user\" or \"group\" in the request body, e.g. {\"type\":\"participant\",\"user\":\"kermit\"}.","Fix field-name typos so your client maps the user/group values to the correct JSON keys.","Validate before sending: fail fast if both identityLink.user and identityLink.group are absent."],"exampleFix":"// before\n{\"type\":\"participant\"}\n// after\n{\"type\":\"participant\",\"user\":\"kermit\"}","handlingStrategy":"validation","validationCode":"if (link.getUser() == null && link.getGroup() == null) {\n    throw new IllegalArgumentException(\"Identity link body must set 'user' or 'group'\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    restClient.createIdentityLink(instanceId, link);\n} catch (HttpClientErrorException.BadRequest e) {\n    if (e.getResponseBodyAsString().contains(\"User or group are required\")) {\n        // correct payload mapping\n    }\n}","preventionTips":["Make user/group required in your client DTO (at least one must be set).","Verify JSON key names match the REST model exactly.","Add contract tests for identity-link payloads."],"tags":["rest-api","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-18T11:17:12.947Z"}