{"record":{"id":"c4042cb479e7980e","repo":"quarkusio/quarkus","slug":"tls-configuration-name-has-already-been-configured","errorCode":null,"errorMessage":"TLS configuration name has already been configured with the 'tls' method","messagePattern":"TLS configuration name has already been configured with the 'tls' method","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/security/MTLS.java","lineNumber":177,"sourceCode":"        /**\n         * Registers a TLS configuration into the registry and configures the TLS configuration used by the HTTP server\n         * for the TLS communication. Please note that this method is mutually exclusive with\n         * the 'quarkus.http.tls-configuration-name' configuration property and if the configuration with this name\n         * is already registered in the TLS registry, validation will fail.\n         * <p>\n         * The passed TLS configuration is not validated, so it's up to the caller to ensure the configuration is correct.\n         *\n         * @param tlsConfigurationName the name of the configuration, cannot be {@code null}, cannot be {@code <default>}\n         * @param tlsConfiguration the configuration cannot be {@code null}\n         * @return Builder\n         * @see io.quarkus.tls.TlsConfigurationRegistry#register(String, TlsConfiguration)\n         * @see VertxHttpConfig#tlsConfigurationName()\n         */\n        public Builder tls(String tlsConfigurationName, TlsConfiguration tlsConfiguration) {\n            Objects.requireNonNull(tlsConfiguration);\n            Objects.requireNonNull(tlsConfigurationName);\n            if (httpServerTlsConfigName.isPresent()) {\n                throw new IllegalArgumentException(\"TLS configuration name has already been configured with the 'tls' method\");\n            }\n            this.httpServerTlsConfigName = Optional.of(tlsConfigurationName);\n            this.tlsConfiguration = tlsConfiguration;\n            return this;\n        }\n\n        /**\n         * When the mutual TLS client authentication is configured with this builder, the client authentication\n         * is {@link ClientAuth#REQUIRED} for all requests by default. If you configure {@link ClientAuth#REQUEST},\n         * the client authentication is accepted if presented by a client.\n         * Use the {@link ClientAuth#REQUEST} option if the client authentication is only required for certain routes\n         * and secure these routes with HTTP permissions or standard security annotations.\n         *\n         * @param clientAuthentication {@link ClientAuth#REQUEST} or {@link ClientAuth#REQUIRED}\n         * @return Builder\n         * @see VertxHttpBuildTimeConfig#tlsClientAuth() for more information\n         */\n        public Builder authentication(ClientAuth clientAuthentication) {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/security/MTLS.java#L159-L195","documentation":"MTLS.Builder.tls(String, TlsConfiguration) throws IllegalArgumentException when the TLS configuration name was already configured via the single-argument tls(String) method. The two tls(...) overloads are mutually exclusive: one sets a named config, the other an explicit TlsConfiguration with a name.","triggerScenarios":"Calling tls(name, tlsConfiguration) after tls(name) was already called on the same builder.","commonSituations":"Mixing two TLS setup styles in one builder; a shared helper method that calls tls(name) followed by app code calling tls(name, config).","solutions":["Use only one tls() overload per builder instance","Remove the earlier tls(name) call if the explicit TlsConfiguration variant is wanted","Split configuration into separate builders if both styles are required"],"exampleFix":"// before\nbuilder.tls(\"db-tls\");\nbuilder.tls(\"db-tls\", tlsConfig); // IllegalArgumentException\n// after\nbuilder.tls(\"db-tls\", tlsConfig);","handlingStrategy":"validation","validationCode":"if (explicitTlsConfig != null) {\n    builder.tls(name, explicitTlsConfig);\n} else {\n    builder.tls(name);\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.tls(name, tlsConfig);\n} catch (IllegalArgumentException e) {\n    // name already set via tls(String) — restructure to a single call\n}","preventionTips":["Choose one TLS configuration style per builder","Let the explicit TlsConfiguration overload take precedence in shared helpers","Document which code path owns TLS setup"],"tags":["quarkus","mtls","illegal-argument","builder-misuse","tls"],"backgroundTag":"builder-state-conflict","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"}