{"record":{"id":"7df3ae114234a53b","repo":"flowable/flowable-engine","slug":"the-identity-link-type-is-required","errorCode":null,"errorMessage":"The identity link type is required.","messagePattern":"The identity link type is 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":84,"sourceCode":"            @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 {\n            runtimeService.addUserIdentityLink(caseInstance.getId(), identityLink.getUser(), identityLink.getType());\n        }\n\n        return restResponseFactory.createRestIdentityLink(identityLink.getType(), identityLink.getUser(), identityLink.getGroup(), null, null, caseInstance.getId());\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":101,"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#L66-L101","documentation":"The identity link body must include a non-null \"type\" (the identity link type, e.g. 'participant', 'owner', or a custom type). If RestIdentityLink.type is null, FlowableIllegalArgumentException(\"The identity link type is required.\") is thrown.","triggerScenarios":"POST /cmmn-runtime/case-instances/{id}/identitylinks with {\"user\":\"kermit\"} and no \"type\" field.","commonSituations":"Client forgetting the type field; assuming the server defaults the type (it does not); schema drift after upgrading the REST API client model.","solutions":["Add \"type\" to the request body, e.g. \"participant\".","Use a known identity link type supported for case instances.","Validate that identityLink.type != null before calling the endpoint."],"exampleFix":"// before\n{\"user\": \"kermit\"}\n// after\n{\"user\": \"kermit\", \"type\": \"participant\"}","handlingStrategy":"validation","validationCode":"// Java\nif (link.getType() == null || link.getType().isEmpty()) {\n    throw new IllegalArgumentException(\"identity link type is required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set type (e.g. participant) on identity link payloads","Do not rely on server-side defaults — none exist","Keep shared client models in sync with RestIdentityLink"],"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"}