apache/rocketmq · error · AuthenticationException

The user is not exist

Error message

The user is not exist

What it means

Update-user admin handler: the async chain loads the existing user by username via AuthenticationMetadataManager.getUser() and throws AuthenticationException('The user is not exist') when it returns null. It means an UPDATE_USER request targeted a username that does not exist in the broker's authentication metadata.

Source

Thrown at broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3296

            response.setCode(ResponseCode.INVALID_PARAMETER);
            response.setRemark("The username is blank");
            return response;
        }

        UserInfo userInfo = RemotingSerializable.decode(request.getBody(), UserInfo.class);
        userInfo.setUsername(requestHeader.getUsername());
        User user = UserConverter.convertUser(userInfo);

        if (user.getUserType() == UserType.SUPER && isNotSuperUserLogin(request)) {
            response.setCode(ResponseCode.SYSTEM_ERROR);
            response.setRemark("The super user can only be update by super user");
            return response;
        }

        this.brokerController.getAuthenticationMetadataManager().getUser(requestHeader.getUsername())
            .thenCompose(old -> {
                if (old == null) {
                    throw new AuthenticationException("The user is not exist");
                }
                if (old.getUserType() == UserType.SUPER && isNotSuperUserLogin(request)) {
                    throw new AuthenticationException("The super user can only be update by super user");
                }
                return this.brokerController.getAuthenticationMetadataManager().updateUser(user);
            }).thenAccept(nil -> response.setCode(ResponseCode.SUCCESS))
            .exceptionally(ex -> {
                LOGGER.error("update user {} error", requestHeader.getUsername(), ex);
                return handleAuthException(response, ex);
            })
            .join();
        return response;
    }

    private RemotingCommand deleteUser(ChannelHandlerContext ctx,
        RemotingCommand request) throws RemotingCommandException {
        final RemotingCommand response = RemotingCommand.createResponseCommand(null);

View on GitHub (pinned to 293f588571)

Solutions

  1. Create the user first with CreateUserRequest (createUser), then issue the update.
  2. Verify the exact username with getUser / listUsers against the same broker before updating.
  3. If using an external authentication metadata manager, confirm it is connected and the user record is visible on this broker.

Example fix

// before
UpdateUserRequestHeader h = new UpdateUserRequestHeader();
h.setUsername("operator1"); // never created -> AuthenticationException

// after
// 1. create, then update
CreateUserRequestHeader c = new CreateUserRequestHeader();
c.setUsername("operator1");
// ... send CREATE_USER first, then UPDATE_USER
Defensive patterns

Strategy: validation

Validate before calling

CompletableFuture<User> existing = authMetadataManager.getUser(username);
if (existing.join() == null) { /* createUser(...) instead of updateUser */ }

Try / catch

catch (CompletionException e) { if (e.getCause() instanceof AuthenticationException && e.getCause().getMessage().contains("not exist")) { createUser(); return; } throw e; }

Prevention

When it happens

Trigger: UpdateUserRequest with a username never created (typo, deleted earlier, or created on a different broker/ACL metadata store); metadata not yet replicated to this broker.

Common situations: Scripts that update users assuming they exist; user was deleted by another operator; in clustered deployments, the authentication metadata (JWT provider / ACL manager) not synced; case-mismatch in username.

Related errors


AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14). Data as JSON: /api/errors/87850f1fac537d7e. Report an issue: GitHub.