{"record":{"id":"135b919d421d5131","repo":"quarkusio/quarkus","slug":"oidc-client-feature-is-disabled-with-quarkus-oidc-135b91","errorCode":null,"errorMessage":"OIDC client feature is disabled with `quarkus.oidc-client.enabled=false` but the getTokens() method is called.","messagePattern":"OIDC client feature is disabled with `quarkus\\.oidc-client\\.enabled=false` but the getTokens\\(\\) method is called\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/AbstractTokensProducer.java","lineNumber":94,"sourceCode":"                    + \" but the initTokens() method is called.\");\n        }\n        if (earlyTokenAcquisition) {\n            // Skip early token acquisition for deferred clients - they will recover on first request\n            if (oidcClient instanceof DeferredOidcClient) {\n                LOG.debug(\"Skipping early token acquisition for deferred OIDC client\");\n                return;\n            }\n            tokensHelper.initTokens(oidcClient, additionalParameters());\n        }\n    }\n\n    public Uni<Tokens> getTokens() {\n        return getTokens(additionalParameters());\n    }\n\n    public Uni<Tokens> getTokens(Map<String, String> additionalParameters) {\n        if (isClientFeatureDisabled()) {\n            throw new IllegalStateException(\"OIDC client feature is disabled with `quarkus.oidc-client.enabled=false`\"\n                    + \" but the getTokens() method is called.\");\n        }\n        final boolean forceNewTokens = isForceNewTokens();\n        if (forceNewTokens) {\n            final Optional<String> clientId = clientId();\n            LOG.debugf(\"%s OidcClient will discard the current access and refresh tokens\",\n                    clientId.orElse(DEFAULT_OIDC_CLIENT_ID));\n        }\n        return tokensHelper.getTokens(oidcClient, additionalParameters, forceNewTokens);\n    }\n\n    public Tokens awaitTokens() {\n        if (isClientFeatureDisabled()) {\n            throw new IllegalStateException(\"OIDC client feature is disabled with `quarkus.oidc-client.enabled=false`.\");\n        }\n        return getTokens().await().indefinitely();\n    }\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/AbstractTokensProducer.java#L76-L112","documentation":"getTokens() on AbstractTokensProducer throws this IllegalStateException when the OIDC client feature was disabled at build time (quarkus.oidc-client.enabled=false) but the application still attempts to acquire tokens at runtime. Without the feature, no OidcClient exists to produce tokens.","triggerScenarios":"Calling getTokens()/getTokens(Map) on a producer bean in an application built with quarkus.oidc-client.enabled=false.","commonSituations":"Injecting TokensProducer into code that remains active even though the extension was disabled at build time; runtime profile differences where the flag was disabled but calling code wasn't.","solutions":["Re-enable the OIDC client feature (remove quarkus.oidc-client.enabled=false).","Do not inject/call TokensProducer in applications where the feature is disabled.","Gate the calling code on feature availability (e.g. check quarkus.oidc-client.enabled via BuildTimeConfig) before calling getTokens()."],"exampleFix":"// before\nTokens t = producer.getTokens().await().indefinitely();\n\n// after\nif (!producer.isClientFeatureDisabled()) {\n    Tokens t = producer.getTokens().await().indefinitely();\n}","handlingStrategy":"try-catch","validationCode":"if (producer.isClientFeatureDisabled()) {\n    throw new IllegalStateException(\"Cannot get tokens: quarkus.oidc-client.enabled=false\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return producer.getTokens().await().indefinitely();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"oidc-client.enabled=false\")) {\n        return null; // or fallback auth path\n    }\n    throw e;\n}","preventionTips":["Check isClientFeatureDisabled() before calling getTokens().","Avoid injecting TokensProducer in apps with the extension disabled.","Add an application-startup smoke test exercising the token path."],"tags":["oidc-client","build-time-config","runtime"],"backgroundTag":"feature-disabled-at-build-time","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}