{"record":{"id":"aab25fee6e5e856d","repo":"apache/rocketmq","slug":"the-authenticationmetadataprovider-is-not-configur-aab25f","errorCode":null,"errorMessage":"The authenticationMetadataProvider is not configured.","messagePattern":"The authenticationMetadataProvider is not configured\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java","lineNumber":211,"sourceCode":"        if (user == null) {\n            throw new AuthenticationException(\"user can not be null\");\n        }\n        if (StringUtils.isBlank(user.getUsername())) {\n            throw new AuthenticationException(\"username can not be blank\");\n        }\n        if (isCreate && StringUtils.isBlank(user.getPassword())) {\n            throw new AuthenticationException(\"password can not be blank\");\n        }\n    }\n\n    private void handleException(Exception e, CompletableFuture<?> result) {\n        Throwable throwable = ExceptionUtils.getRealException(e);\n        result.completeExceptionally(throwable);\n    }\n\n    private AuthenticationMetadataProvider getAuthenticationMetadataProvider() {\n        if (authenticationMetadataProvider == null) {\n            throw new IllegalStateException(\"The authenticationMetadataProvider is not configured.\");\n        }\n        return authenticationMetadataProvider;\n    }\n\n    private AuthorizationMetadataProvider getAuthorizationMetadataProvider() {\n        if (authorizationMetadataProvider == null) {\n            throw new IllegalStateException(\"The authorizationMetadataProvider is not configured.\");\n        }\n        return authorizationMetadataProvider;\n    }\n}\n","sourceCodeStart":193,"sourceCodeEnd":223,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java#L193-L223","documentation":"IllegalStateException from the manager's lazy accessor: AuthenticationMetadataManagerImpl was built without an AuthenticationMetadataProvider, so any user operation that needs the store (create/update/delete/get/list) fails at runtime. Unlike the AuthenticationExceptions around it, this is an unrecoverable wiring error - the manager cannot function.","triggerScenarios":"Constructing AuthenticationMetadataManagerImpl without initializing its authenticationMetadataProvider (null config / provider creation skipped) and then invoking any user-management method; typically fires inside a try block and is converted to a failed CompletableFuture by handleException.","commonSituations":"Custom embedding of the auth module where the manager was new'd directly instead of via AuthenticationFactory; configuration missing the metadata provider classname so init left it null; test setups that stub the manager incompletely.","solutions":["Initialize the manager through AuthenticationFactory / the standard broker wiring so the metadata provider is constructed from AuthConfig.","If embedding manually, pass a non-null AuthenticationMetadataProvider (and AuthorizationMetadataProvider) to the manager's initialization path.","Fail fast at startup: after construction, call a cheap operation (e.g. listUser) in a startup self-check so misconfiguration surfaces immediately, not on first admin call."],"exampleFix":"// before\nAuthenticationMetadataManagerImpl manager = new AuthenticationMetadataManagerImpl();\nmanager.createUser(user); // IllegalStateException at runtime\n\n// after\nAuthenticationMetadataManager manager = AuthenticationFactory.getMetadataManager(authConfig, metadataService);\nmanager.createUser(user);","handlingStrategy":"validation","validationCode":"// Startup wiring self-check\nAuthenticationMetadataManager m =\n    AuthenticationFactory.getMetadataManager(authConfig, metadataService);\nm.listUser(null).join(); // surfaces missing-provider wiring at boot, not at first admin call","typeGuard":null,"tryCatchPattern":"catch (IllegalStateException e) { if message contains \"authenticationMetadataProvider is not configured\" -> abort startup with a config error; this cannot be retried at runtime. }","preventionTips":["Always build managers via AuthenticationFactory, never bare new","Include an auth smoke test in deployment pipelines"],"tags":["rocketmq","configuration","metadata-provider","server"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}