{"record":{"id":"5aece7953e21019c","repo":"apache/rocketmq","slug":"username-can-not-be-blank","errorCode":null,"errorMessage":"username can not be blank","messagePattern":"username can not be blank","errorType":"exception","errorClass":"AuthenticationException","httpStatus":null,"severity":"error","filePath":"auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java","lineNumber":146,"sourceCode":"                    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\n    @Override\n    public CompletableFuture<Void> deleteUser(String username) {\n        CompletableFuture<Void> result = new CompletableFuture<>();\n        try {\n            if (StringUtils.isBlank(username)) {\n                throw new AuthenticationException(\"username can not be blank\");\n            }\n            CompletableFuture<Void> deleteUser = this.getAuthenticationMetadataProvider().deleteUser(username);\n            CompletableFuture<Void> deleteAcl = this.getAuthorizationMetadataProvider().deleteAcl(User.of(username));\n            return CompletableFuture.allOf(deleteUser, deleteAcl);\n        } catch (Exception e) {\n            this.handleException(e, result);\n        }\n        return result;\n    }\n\n    @Override\n    public CompletableFuture<User> getUser(String username) {\n        CompletableFuture<User> result = new CompletableFuture<>();\n        try {\n            if (StringUtils.isBlank(username)) {\n                throw new AuthenticationException(\"username can not be blank\");\n            }\n            result = this.getAuthenticationMetadataProvider().getUser(username);","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java#L128-L164","documentation":"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.","triggerScenarios":"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.","commonSituations":"Admin tooling or scripts passing an unset option (-u omitted); deserialized User/DTO with null username reaching the delete path; UI form submitted empty.","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."],"exampleFix":"// before\nauthManager.deleteUser(username); // username == null\n\n// after\nif (StringUtils.isBlank(username)) throw new IllegalArgumentException(\"username required\");\nauthManager.deleteUser(username.trim());","handlingStrategy":"validation","validationCode":"if (username == null || username.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"username must be provided for deleteUser\");\n}\nauthManager.deleteUser(username.trim());","typeGuard":"boolean isDeletableUser(String u) { return u != null && !u.trim().isEmpty(); }","tryCatchPattern":"catch (AuthenticationException e) { if message contains \"blank\" -> fix caller input plumbing; this is a client bug, never retry. }","preventionTips":["Require CLI/API username arguments with strict parsing","Centralize blank-checks in one guard shared by all admin calls"],"tags":["rocketmq","user-management","delete","validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}