{"record":{"id":"06224b40362ea813","repo":"redis/jedis","slug":"authxmanager-failed-to-start","errorCode":null,"errorMessage":"AuthXManager failed to start!","messagePattern":"AuthXManager failed to start!","errorType":"exception","errorClass":"JedisAuthenticationException","httpStatus":null,"severity":"critical","filePath":"src/main/java/redis/clients/jedis/authentication/AuthXManager.java","lineNumber":52,"sourceCode":"    private final List<Consumer<Token>> postAuthenticateHooks = new ArrayList<>();\n    private final AtomicReference<CompletableFuture<Void>> uniqueStarterTask = new AtomicReference<>();\n\n    protected AuthXManager(TokenManager tokenManager) {\n        this.tokenManager = tokenManager;\n    }\n\n    public AuthXManager(TokenAuthConfig tokenAuthConfig) {\n        this(new TokenManager(tokenAuthConfig.getIdentityProviderConfig().getProvider(),\n                tokenAuthConfig.getTokenManagerConfig()));\n    }\n\n    public void start() {\n        Future<Void> safeStarter = safeStart(this::tokenManagerStart);\n        try {\n            safeStarter.get();\n        } catch (InterruptedException | ExecutionException e) {\n            log.error(\"AuthXManager failed to start!\", e);\n            throw new JedisAuthenticationException(\"AuthXManager failed to start!\",\n                    (e instanceof ExecutionException) ? e.getCause() : e);\n        }\n    }\n\n    private Future<Void> safeStart(Runnable starter) {\n        if (uniqueStarterTask.compareAndSet(null, new CompletableFuture<Void>())) {\n            try {\n                starter.run();\n                uniqueStarterTask.get().complete(null);\n            } catch (Exception e) {\n                uniqueStarterTask.get().completeExceptionally(e);\n            }\n        }\n        return uniqueStarterTask.get();\n    }\n\n    private void tokenManagerStart() {\n        tokenManager.start(new TokenListener() {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/authentication/AuthXManager.java#L34-L70","documentation":"AuthXManager coordinates periodic re-authentication using token managers (e.g. for IAM/OIDC-style identity tokens). start() submits the token manager start task and waits; if that task fails (InterruptedException or ExecutionException), it logs and rethrows as JedisAuthenticationException.","triggerScenarios":"The underlying token manager fails to initialize/fetch its first token: unreachable identity/credentials provider, invalid credentials, network timeouts, or the start thread is interrupted.","commonSituations":"Wrong OIDC/IAM endpoint configured, expired or missing credentials, corporate proxy blocking the token endpoint, container DNS failures, JDK interruption during shutdown.","solutions":["Inspect the logged cause (e.getCause()) for the token manager's root failure.","Verify identity/token provider endpoint, credentials, and network reachability.","Retry client construction after fixing credentials/endpoint.","Check for premature thread interruption in your shutdown code."],"exampleFix":"// before\nAuthXManager m = new AuthXManager(badTokenManagerConfig);\nm.start(); // JedisAuthenticationException\n// after\n// fix tokenManager config: correct endpoint + valid credentials, then\nAuthXManager m = new AuthXManager(correctConfig);\nm.start();","handlingStrategy":"try-catch","validationCode":"// pre-check token manager reachability\ntry (Socket s = new Socket(tokenHost, tokenPort)) { /* reachable */ }","typeGuard":null,"tryCatchPattern":"try {\n  authXManager.start();\n} catch (JedisAuthenticationException e) {\n  Throwable root = e.getCause();\n  log.error(\"Token manager startup failed\", root);\n}","preventionTips":["Validate token provider endpoint/credentials before startup","Inspect e.getCause() for the root failure","Ensure network/proxy allows the token endpoint","Avoid interrupting startup threads during shutdown"],"tags":["authentication","token-manager","jedis","startup"],"backgroundTag":"authentication-required","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}