{"record":{"id":"767a33dd18059208","repo":"quarkusio/quarkus","slug":"oidc-client-feature-is-disabled-with-quarkus-oidc-767a33","errorCode":null,"errorMessage":"OIDC client feature is disabled with `quarkus.oidc-client.enabled=false`.","messagePattern":"OIDC client feature is disabled with `quarkus\\.oidc-client\\.enabled=false`\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/AbstractTokensProducer.java","lineNumber":108,"sourceCode":"    }\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\n    /**\n     * @return optional ID of OIDC client to use for token acquisition.\n     *         Defaults to default OIDC client when {@link Optional#empty() empty}.\n     */\n    protected Optional<String> clientId() {\n        return Optional.empty();\n    }\n\n    /**\n     * @return Initialized OidcClient.\n     */\n    protected Optional<OidcClient> client() {\n        return Optional.empty();\n    }","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/AbstractTokensProducer.java#L90-L126","documentation":"awaitTokens() blocks and returns Tokens synchronously, but first checks the same build-time flag. With quarkus.oidc-client.enabled=false it throws IllegalStateException because token acquisition is impossible in the disabled feature.","triggerScenarios":"Calling awaitTokens() on an AbstractTokensProducer subclass in an application built with quarkus.oidc-client.enabled=false.","commonSituations":"Synchronous (non-reactive) code paths calling awaitTokens() in services where the OIDC client extension was disabled at build time to reduce footprint.","solutions":["Re-enable the feature by removing or setting quarkus.oidc-client.enabled=true.","Remove the awaitTokens() call path when the feature is disabled.","Conditionally invoke awaitTokens() only when isClientFeatureDisabled() is false."],"exampleFix":"// before\nTokens t = producer.awaitTokens();\n\n// after\nif (!producer.isClientFeatureDisabled()) {\n    Tokens t = producer.awaitTokens();\n}","handlingStrategy":"try-catch","validationCode":"if (producer.isClientFeatureDisabled()) {\n    throw new IllegalStateException(\"Cannot await tokens: quarkus.oidc-client.enabled=false\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Tokens t = producer.awaitTokens();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"oidc-client.enabled=false\")) {\n        throw new ServiceUnavailableException(\"OIDC client feature disabled\");\n    }\n    throw e;\n}","preventionTips":["Gate synchronous token paths on the build-time flag.","Do not share producer-based code across enabled/disabled app profiles.","Verify flag value in integration tests for both profiles."],"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"}