apache/rocketmq · error · AuthenticationException
The user is not exist
Error message
The user is not exist
What it means
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.
Source
Thrown at auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:122
if (old != null) {
throw new AuthenticationException("The user is existed");
}
return this.getAuthenticationMetadataProvider().createUser(user);
});
} catch (Exception e) {
this.handleException(e, result);
}
return result;
}
@Override
public CompletableFuture<Void> updateUser(User user) {
CompletableFuture<Void> result = new CompletableFuture<>();
try {
this.validate(user, false);
result = this.getAuthenticationMetadataProvider().getUser(user.getUsername()).thenCompose(old -> {
if (old == null) {
throw new AuthenticationException("The user is not exist");
}
if (StringUtils.isNotBlank(user.getPassword())) {
old.setPassword(user.getPassword());
}
if (user.getUserType() != null) {
old.setUserType(user.getUserType());
}
if (user.getUserStatus() != null) {
old.setUserStatus(user.getUserStatus());
}
return this.getAuthenticationMetadataProvider().updateUser(old);
});
} catch (Exception e) {
this.handleException(e, result);
}
return result;
}
View on GitHub (pinned to 293f588571)
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.
Example fix
// before
authManager.updateUser(User.of("alice", "newPw")); // alice never created
// after
authManager.getUser("alice")
.thenCompose(existing -> existing == null
? authManager.createUser(User.of("alice", "newPw"))
: authManager.updateUser(User.of("alice", "newPw"))); Defensive patterns
Strategy: fallback
Validate before calling
authManager.getUser(username)
.thenCompose(existing -> existing == null
? authManager.createUser(user) // create-if-missing
: authManager.updateUser(user)); Try / catch
catch (AuthenticationException e) { if message contains "user is not exist" -> fall back to createUser with the intended attributes, then re-apply the update. } Prevention
- Use existence-aware upsert helpers in admin tooling
- Re-verify username casing/whitespace before updates
When it happens
Trigger: Calling updateUser / mqadmin updateUser for a username never created, or one that was deleted concurrently (e.g. between a list and the update).
Common situations: Provisioning scripts assuming a default user exists; typos in the username; race where another admin deleted the user; wrong metadata store pointed at.
Related errors
- User:{} is not found.
- The user is existed
- username can not be blank
- User:{} is not found
- user can not be null
AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14).
Data as JSON: /api/errors/91b7e3f8a65a6bb4.
Report an issue: GitHub.