quarkusio/quarkus · error · OidcClientException

'id' property must be set

Error message

'id' property must be set

What it means

OidcClientsImpl.newClient requires every dynamically created OidcClientConfig to carry an id, since the id identifies the named client configuration. This OidcClientException is thrown synchronously when id is absent.

Source

Thrown at extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientsImpl.java:101

        return staticOidcClients.get(id);
    }

    public Map<String, OidcClient> getStaticOidcClients() {
        return staticOidcClients;
    }

    @Override
    public void close() throws IOException {
        defaultClient.close();
        for (OidcClient client : staticOidcClients.values()) {
            client.close();
        }
    }

    @Override
    public Uni<OidcClient> newClient(OidcClientConfig clientConfig) {
        if (clientConfig.id().isEmpty()) {
            throw new OidcClientException("'id' property must be set");
        }
        return createOidcClientUni(clientConfig, clientConfig.id().get(), vertx, tlsSupport, proxyConfigurationRegistry);
    }

    @Singleton
    @Produces
    @Unremovable
    OidcClient createOidcClientBean() {
        return defaultClient;
    }

    @PreDestroy
    void destroy() {
        try {
            close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set the id on the OidcClientConfig before calling newClient (e.g. config with quarkus.oidc-client."name".id=name)
  2. Ensure the config source actually includes the id property
  3. If using OidcClientConfig programmatically, call the builder/setter that populates id

Example fix

// before
OidcClientConfig cfg = new OidcClientConfig();
// no id set
client = oidcClients.newClient(cfg); // throws

// after
OidcClientConfig cfg = new OidcClientConfig();
cfg.id(Optional.of("my-client"));
client = oidcClients.newClient(cfg);
Defensive patterns

Strategy: validation

Validate before calling

if (clientConfig.id().isEmpty()) { throw new IllegalArgumentException("OidcClientConfig.id must be set before newClient()"); }

Type guard

boolean hasId(OidcClientConfig c) { return c.id().isPresent() && !c.id().get().isBlank(); }

Try / catch

try { client = oidcClients.newClient(cfg); } catch (OidcClientException e) { if (e.getMessage().contains("'id' property must be set")) { cfg = withId(cfg, "default"); client = oidcClients.newClient(cfg); } else throw e; }

Prevention

When it happens

Trigger: Calling OidcClients.newClient(config) with an OidcClientConfig whose id property (config.id()) is unset — programmatic client creation without assigning the identifier.

Common situations: Building OidcClientConfig programmatically for a named client and forgetting .setId(); config mapping binding from properties that lack quarkus.oidc-client.<name>.id or an id when created ad hoc.

Related errors


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