{"record":{"id":"e04fad4f56c0fbaf","repo":"flowable/flowable-engine","slug":"the-key-cannot-be-null","errorCode":null,"errorMessage":"The key cannot be null.","messagePattern":"The key cannot be null\\.","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserInfoCollectionResource.java","lineNumber":78,"sourceCode":"\n        return restResponseFactory.createUserInfoKeysResponse(identityService.getUserInfoKeys(user.getId()), user.getId());\n    }\n\n    @ApiOperation(value = \"Create a new user’s info entry\", tags = { \"Users\" }, nickname = \"createUserInfo\", code = 201)\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates the user was found and the info has been created.\"),\n            @ApiResponse(code = 400, message = \"Indicates the key or value was missing from the request body. Status description contains additional information about the error.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested user was not found.\"),\n            @ApiResponse(code = 409, message = \"Indicates there is already an info-entry with the given key for the user, update the resource instance (PUT).\")\n    })\n    @PostMapping(value = \"/identity/users/{userId}/info\", produces = \"application/json\")\n    @ResponseStatus(HttpStatus.CREATED)\n    public UserInfoResponse setUserInfo(@ApiParam(name = \"userId\") @PathVariable String userId, @RequestBody UserInfoRequest userRequest) {\n\n        User user = getUserFromRequest(userId);\n\n        if (userRequest.getKey() == null) {\n            throw new FlowableIllegalArgumentException(\"The key cannot be null.\");\n        }\n        if (userRequest.getValue() == null) {\n            throw new FlowableIllegalArgumentException(\"The value cannot be null.\");\n        }\n\n        String existingValue = identityService.getUserInfo(user.getId(), userRequest.getKey());\n        if (existingValue != null) {\n            throw new FlowableConflictException(\"User info with key '\" + userRequest.getKey() + \"' already exists for this user.\");\n        }\n\n        identityService.setUserInfo(user.getId(), userRequest.getKey(), userRequest.getValue());\n\n        return restResponseFactory.createUserInfoResponse(userRequest.getKey(), userRequest.getValue(), user.getId());\n    }\n}\n","sourceCodeStart":60,"sourceCodeEnd":94,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserInfoCollectionResource.java#L60-L94","documentation":"REST request validation in UserInfoCollectionResource.setUserInfo: a user-info entry was submitted without a key. Info entries are key/value pairs addressed by key, so a missing key makes the request unprocessible.","triggerScenarios":"Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserInfoCollectionResource.java:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include a non-null 'key' field in the request JSON","Validate the payload client-side before the call"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}