{"record":{"id":"91b7e3f8a65a6bb4","repo":"apache/rocketmq","slug":"the-user-is-not-exist","errorCode":null,"errorMessage":"The user is not exist","messagePattern":"The user is not exist","errorType":"exception","errorClass":"AuthenticationException","httpStatus":null,"severity":"error","filePath":"auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java","lineNumber":122,"sourceCode":"                if (old != null) {\n                    throw new AuthenticationException(\"The user is existed\");\n                }\n                return this.getAuthenticationMetadataProvider().createUser(user);\n            });\n        } catch (Exception e) {\n            this.handleException(e, result);\n        }\n        return result;\n    }\n\n    @Override\n    public CompletableFuture<Void> updateUser(User user) {\n        CompletableFuture<Void> result = new CompletableFuture<>();\n        try {\n            this.validate(user, false);\n            result = this.getAuthenticationMetadataProvider().getUser(user.getUsername()).thenCompose(old -> {\n                if (old == null) {\n                    throw new AuthenticationException(\"The user is not exist\");\n                }\n                if (StringUtils.isNotBlank(user.getPassword())) {\n                    old.setPassword(user.getPassword());\n                }\n                if (user.getUserType() != null) {\n                    old.setUserType(user.getUserType());\n                }\n                if (user.getUserStatus() != null) {\n                    old.setUserStatus(user.getUserStatus());\n                }\n                return this.getAuthenticationMetadataProvider().updateUser(old);\n            });\n        } catch (Exception e) {\n            this.handleException(e, result);\n        }\n        return result;\n    }\n","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java#L104-L140","documentation":"Admin operation updateUser was rejected because getUser(username) returned null - you cannot update a user that does not exist. The manager patches the stored record field-by-field, so it requires the old record to be present.","triggerScenarios":"Calling updateUser / mqadmin updateUser for a username never created, or one that was deleted concurrently (e.g. between a list and the update).","commonSituations":"Provisioning scripts assuming a default user exists; typos in the username; race where another admin deleted the user; wrong metadata store pointed at.","solutions":["Create the user first with createUser if it should exist.","Verify the exact username with listUser/getUser before updating.","In concurrent admin flows, re-check existence immediately before the update or use the returned error to re-drive creation."],"exampleFix":"// before\nauthManager.updateUser(User.of(\"alice\", \"newPw\")); // alice never created\n\n// after\nauthManager.getUser(\"alice\")\n    .thenCompose(existing -> existing == null\n        ? authManager.createUser(User.of(\"alice\", \"newPw\"))\n        : authManager.updateUser(User.of(\"alice\", \"newPw\")));","handlingStrategy":"fallback","validationCode":"authManager.getUser(username)\n    .thenCompose(existing -> existing == null\n        ? authManager.createUser(user)   // create-if-missing\n        : authManager.updateUser(user));","typeGuard":null,"tryCatchPattern":"catch (AuthenticationException e) { if message contains \"user is not exist\" -> fall back to createUser with the intended attributes, then re-apply the update. }","preventionTips":["Use existence-aware upsert helpers in admin tooling","Re-verify username casing/whitespace before updates"],"tags":["rocketmq","user-management","update","not-found"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}