apache/rocketmq · error · AuthenticationException
username can not be blank
Error message
username can not be blank
What it means
deleteUser rejected the call because the username argument is null, empty, or whitespace-only (StringUtils.isBlank). deleteUser also cascades an ACL deletion for the user, so a blank name could not resolve either operation.
Source
Thrown at auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:146
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;
}
@Override
public CompletableFuture<Void> deleteUser(String username) {
CompletableFuture<Void> result = new CompletableFuture<>();
try {
if (StringUtils.isBlank(username)) {
throw new AuthenticationException("username can not be blank");
}
CompletableFuture<Void> deleteUser = this.getAuthenticationMetadataProvider().deleteUser(username);
CompletableFuture<Void> deleteAcl = this.getAuthorizationMetadataProvider().deleteAcl(User.of(username));
return CompletableFuture.allOf(deleteUser, deleteAcl);
} catch (Exception e) {
this.handleException(e, result);
}
return result;
}
@Override
public CompletableFuture<User> getUser(String username) {
CompletableFuture<User> result = new CompletableFuture<>();
try {
if (StringUtils.isBlank(username)) {
throw new AuthenticationException("username can not be blank");
}
result = this.getAuthenticationMetadataProvider().getUser(username);View on GitHub (pinned to 293f588571)
Solutions
- Pass a concrete, trimmed username to deleteUser.
- Validate required CLI/API arguments before invoking the manager.
- Log the offending input at the call site to catch empty propagation early.
Example fix
// before
authManager.deleteUser(username); // username == null
// after
if (StringUtils.isBlank(username)) throw new IllegalArgumentException("username required");
authManager.deleteUser(username.trim()); Defensive patterns
Strategy: validation
Validate before calling
if (username == null || username.trim().isEmpty()) {
throw new IllegalArgumentException("username must be provided for deleteUser");
}
authManager.deleteUser(username.trim()); Type guard
boolean isDeletableUser(String u) { return u != null && !u.trim().isEmpty(); } Try / catch
catch (AuthenticationException e) { if message contains "blank" -> fix caller input plumbing; this is a client bug, never retry. } Prevention
- Require CLI/API username arguments with strict parsing
- Centralize blank-checks in one guard shared by all admin calls
When it happens
Trigger: Invoking deleteUser(null), deleteUser(""), or deleteUser(" ") - commonly when a variable holding the username failed to populate from CLI args, config, or an upstream API payload.
Common situations: Admin tooling or scripts passing an unset option (-u omitted); deserialized User/DTO with null username reaching the delete path; UI form submitted empty.
Related errors
- user can not be null
- password can not be blank
- authentication credential length is incorrect, actual length
- User:{} is not found.
- The user is existed
AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14).
Data as JSON: /api/errors/5aece7953e21019c.
Report an issue: GitHub.