quarkusio/quarkus · error · UnsupportedOperationException

Use the 'OidcClientCommonConfigBuilder.CredentialsBuilder#bu

Error message

Use the 'OidcClientCommonConfigBuilder.CredentialsBuilder#build' method instead

What it means

OidcClientCommonConfigBuilder.forClientCommonConfig returns an anonymous builder whose overridden getBuilder() always throws UnsupportedOperationException, deliberately blocking use of a builder method that is no longer valid in this context. It is an API-misuse guard: the CredentialsBuilder#build path must be used instead.

Source

Thrown at extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/config/OidcClientCommonConfigBuilder.java:293

        }

        /**
         * @return Credentials
         */
        public Credentials build() {
            return new CredentialsImpl(secret, clientSecret, jwt, forAllEndpoints);
        }

        private static <T> OidcClientCommonConfigBuilder<T> getConfigBuilderWithDefaults() {
            final OidcClientCommonConfig clientCommonConfig = new SmallRyeConfigBuilder()
                    .addDiscoveredConverters()
                    .withMapping(OidcClientCommonConfig.class)
                    .build()
                    .getConfigMapping(OidcClientCommonConfig.class);
            return new OidcClientCommonConfigBuilder<>(clientCommonConfig) {
                @Override
                protected T getBuilder() {
                    throw new UnsupportedOperationException(
                            "Use the 'OidcClientCommonConfigBuilder.CredentialsBuilder#build' method instead");
                }
            };
        }
    }

    /**
     * The {@link Secret} builder.
     */
    public static final class SecretBuilder<T> {

        private record SecretImpl(Optional<String> value, Optional<Method> method, Provider provider) implements Secret {
        }

        private final CredentialsBuilder<T> builder;

        private Optional<String> value;
        private Optional<Method> method;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use the OidcClientCommonConfigBuilder.CredentialsBuilder#build method to finish credential configuration
  2. Migrate programmatic config code to the current builder API
  3. If extending the builder, provide your own getBuilder implementation instead of relying on the shared forClientCommonConfig instance

Example fix

// before
builder.credentials().getBuilder()...
// after
builder.credentials().build()
Defensive patterns

Strategy: type-guard

Validate before calling

// use only the public supported API
OidcClientCommonConfigBuilder<?, ?> b = OidcClientCommonConfigBuilder.forClientCommonConfig(config);
b.credentials(cb -> cb.build());

Type guard

boolean isThrowingBuilder(OidcClientCommonConfigBuilder<?, ?> b) {
    return b.getClass().isAnonymousClass(); // forClientCommonConfig returns a throwing getBuilder()
}

Prevention

When it happens

Trigger: Invoking getBuilder() (or the deprecated fluent path that relies on it) on the builder created by OidcClientCommonConfigBuilder.forClientCommonConfig instead of using CredentialsBuilder#build.

Common situations: Programmatic OIDC client configuration written against an older builder API, then upgraded; IDE auto-completion suggesting the old method; custom code extending OidcClientCommonConfigBuilder without overriding getBuilder.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/175684c08c7a0ead. Report an issue: GitHub.