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
- Call id("...") with a non-empty name before build().
- If the id comes from configuration/environment, validate it is non-blank before building, or default it.
- 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
- Always call id(...) first when using the builder.
- Resolve ids from configuration keys, which are non-empty by construction.
- Validate environment-sourced ids before building configs.
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
- name cannot be null
- Unrecognized dependency flag '<trimmed>'. Supported flags: O
- Parameter 'mode' was set to '<mode>' while expected one of '
- Parameter 'mode' was set to '<mode>' while expected one of '
- Parameter 'mode' was set to '<mode>' while expected one of '
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/232143573325fa88.
Report an issue: GitHub.