quarkusio/quarkus · error · IllegalArgumentException

Client ID cannot be empty

Error message

Client ID cannot be empty

What it means

The OidcClientConfig.Builder requires a non-empty client ID before build() can produce an OidcClientConfig. The builder's id field was left empty, so an IllegalArgumentException is thrown instead of creating an invalid config object.

Source

Thrown at extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfigBuilder.java:387

     * Creates {@link OidcClientConfig#grant()} builder.
     *
     * @return GrantBuilder
     */
    public GrantBuilder grant() {
        return new GrantBuilder(this);
    }

    public OidcClientConfigBuilder refreshInterval(Duration refreshInterval) {
        this.refreshInterval = Optional.ofNullable(refreshInterval);
        return this;
    }

    /**
     * @return OidcClientConfig
     */
    public OidcClientConfig build() {
        if (id.isEmpty()) {
            throw new IllegalArgumentException("Client ID cannot be empty");
        }
        return new OidcClientConfigImpl(this);
    }

    public static final class GrantBuilder {

        private record GrantImpl(Type type, String accessTokenProperty, String refreshTokenProperty, String expiresInProperty,
                String refreshExpiresInProperty) implements Grant {

        }

        private final OidcClientConfigBuilder builder;
        private Grant.Type type;
        private String accessTokenProperty;
        private String refreshTokenProperty;
        private String expiresInProperty;
        private String refreshExpiresInProperty;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Call id("...") with a non-empty name before build().
  2. If the id comes from configuration/environment, validate it is non-blank before building, or default it.
  3. When iterating over configs, ensure each entry's key is used as the builder id.

Example fix

// before
OidcClientConfig cfg = new OidcClientConfigBuilder().build();

// after
OidcClientConfig cfg = new OidcClientConfigBuilder()
    .id("my-client")
    .build();
Defensive patterns

Strategy: validation

Validate before calling

if (clientId == null || clientId.isBlank()) {
    throw new IllegalArgumentException("Client ID must be set before OidcClientConfigBuilder.build()");
}

Try / catch

try {
    OidcClientConfig cfg = builder.build();
} catch (IllegalArgumentException e) {
    LOG.error("OIDC client config missing id: " + e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Calling new OidcClientConfigBuilder() (or OidcClientConfig.builder()) and invoking build() without calling id("...") first, or passing Optional.empty/null to the id setter.

Common situations: Programmatic OIDC client configuration where the client id comes from an unset environment variable or empty config property; dynamically building configs in a loop where one entry lacks an id.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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