quarkusio/quarkus · error · OIDCException

Unable to find TokenCustomizer %s

Error message

Unable to find TokenCustomizer %s

What it means

Quarkus OIDC looks up a named TokenCustomizer CDI bean when quarkus.oidc.<tenant>.token.customizer-name is set. This error is thrown when no bean with that name (or with that @Identifier) exists in the container, so token customization cannot proceed.

Source

Thrown at extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantFeatureFinder.java:36

public class TenantFeatureFinder {

    private TenantFeatureFinder() {

    }

    public static TokenCustomizer find(OidcTenantConfig oidcConfig) {
        if (oidcConfig == null) {
            return null;
        }
        ArcContainer container = Arc.container();
        if (container != null) {
            String customizerName = oidcConfig.token().customizerName().orElse(null);
            if (customizerName != null && !customizerName.isEmpty()) {
                InstanceHandle<TokenCustomizer> tokenCustomizer = container.instance(customizerName);
                if (tokenCustomizer.isAvailable()) {
                    return tokenCustomizer.get();
                } else {
                    throw new OIDCException("Unable to find TokenCustomizer " + customizerName);
                }
            } else if (oidcConfig.tenantId().isPresent()) {
                List<TokenCustomizer> tokenCustomizers = find(oidcConfig, TokenCustomizer.class);
                if (tokenCustomizers.isEmpty()) {
                    return null;
                }
                if (tokenCustomizers.size() == 1) {
                    return tokenCustomizers.get(0);
                }
                return new TokenCustomizer() {
                    @Override
                    public JsonObject customizeHeaders(JsonObject headers) {
                        JsonObject result = headers;
                        for (TokenCustomizer tokenCustomizer : tokenCustomizers) {
                            var customizedHeaders = tokenCustomizer.customizeHeaders(result);
                            if (customizedHeaders != null) {
                                result = customizedHeaders;
                            }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Annotate your TokenCustomizer bean with jakarta.enterprise.util.AnnotationLiteral-based @io.quarkus.oidc.TokenCustomizer qualifier or @Identifier("<name>") matching exactly the configured customizer-name value.
  2. Verify the property value has no typos and matches the bean identifier character-for-character.
  3. Ensure the customizer class is a CDI bean (add @ApplicationScoped) and lives in a module included in the application build.

Example fix

// before
@ApplicationScoped
public class MyCustomizer implements TokenCustomizer { ... }
# application.properties: quarkus.oidc.token.customizer-name=my-customizer

// after
@ApplicationScoped
@Identifier("my-customizer")
public class MyCustomizer implements TokenCustomizer { ... }
Defensive patterns

Strategy: validation

Validate before calling

String name = config.token().customizerName().orElse(null);
if (name != null && Arc.container().instance(name, TokenCustomizer.class) == null /* not available */) {
    throw new IllegalStateException("No TokenCustomizer bean named " + name);
}

Try / catch

try {
    customizer = featureFinder.find(config);
} catch (OIDCException e) {
    LOG.errorf("TokenCustomizer '%s' not found: %s", config.token().customizerName().orElse(""), e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: quarkus.oidc.token.customizer-name (or tenant-specific equivalent) references a name for which container.instance(customizerName) returns no available TokenCustomizer bean at TenantFeatureFinder.find time.

Common situations: Typo in the customizer-name property; TokenCustomizer bean not annotated with @Identifier matching the configured name; bean not registered as a CDI bean (missing @ApplicationScoped); extension/module containing the customizer not included in the build.

Related errors


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