{"record":{"id":"232143573325fa88","repo":"quarkusio/quarkus","slug":"client-id-cannot-be-empty","errorCode":null,"errorMessage":"Client ID cannot be empty","messagePattern":"Client ID cannot be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfigBuilder.java","lineNumber":387,"sourceCode":"     * Creates {@link OidcClientConfig#grant()} builder.\n     *\n     * @return GrantBuilder\n     */\n    public GrantBuilder grant() {\n        return new GrantBuilder(this);\n    }\n\n    public OidcClientConfigBuilder refreshInterval(Duration refreshInterval) {\n        this.refreshInterval = Optional.ofNullable(refreshInterval);\n        return this;\n    }\n\n    /**\n     * @return OidcClientConfig\n     */\n    public OidcClientConfig build() {\n        if (id.isEmpty()) {\n            throw new IllegalArgumentException(\"Client ID cannot be empty\");\n        }\n        return new OidcClientConfigImpl(this);\n    }\n\n    public static final class GrantBuilder {\n\n        private record GrantImpl(Type type, String accessTokenProperty, String refreshTokenProperty, String expiresInProperty,\n                String refreshExpiresInProperty) implements Grant {\n\n        }\n\n        private final OidcClientConfigBuilder builder;\n        private Grant.Type type;\n        private String accessTokenProperty;\n        private String refreshTokenProperty;\n        private String expiresInProperty;\n        private String refreshExpiresInProperty;\n","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfigBuilder.java#L369-L405","documentation":"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.","triggerScenarios":"Calling new OidcClientConfigBuilder() (or OidcClientConfig.builder()) and invoking build() without calling id(\"...\") first, or passing Optional.empty/null to the id setter.","commonSituations":"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.","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."],"exampleFix":"// before\nOidcClientConfig cfg = new OidcClientConfigBuilder().build();\n\n// after\nOidcClientConfig cfg = new OidcClientConfigBuilder()\n    .id(\"my-client\")\n    .build();","handlingStrategy":"validation","validationCode":"if (clientId == null || clientId.isBlank()) {\n    throw new IllegalArgumentException(\"Client ID must be set before OidcClientConfigBuilder.build()\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    OidcClientConfig cfg = builder.build();\n} catch (IllegalArgumentException e) {\n    LOG.error(\"OIDC client config missing id: \" + e.getMessage());\n    throw e;\n}","preventionTips":["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."],"tags":["oidc-client","configuration","builder","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}