{"record":{"id":"21e396af62f2e7a9","repo":"flowable/flowable-engine","slug":"user-info-with-key-already-exists-for-this-user","errorCode":null,"errorMessage":"User info with key '' already exists for this user.","messagePattern":"User info with key '' already exists for this user\\.","errorType":"http","errorClass":"FlowableConflictException","httpStatus":409,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserInfoCollectionResource.java","lineNumber":86,"sourceCode":"            @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":68,"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#L68-L94","documentation":"Duplicate-entry violation in UserInfoCollectionResource.setUserInfo: the user already has an info entry stored under the given key, so creating it again is refused; the client should update the existing entry (PUT) instead.","triggerScenarios":"Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserInfoCollectionResource.java:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use PUT /identity/users/{userId}/info/{key} to update the entry","Pick a different key","DELETE the existing entry before recreating it"],"exampleFix":null,"handlingStrategy":"try-catch","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"}