{"record":{"id":"7f1cd4828cceafeb","repo":"quarkusio/quarkus","slug":"the-name-of-the-tls-configuration-to-register-cann","errorCode":null,"errorMessage":"The name of the TLS configuration to register cannot be null","messagePattern":"The name of the TLS configuration to register cannot be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/CertificateRecorder.java","lineNumber":214,"sourceCode":"        if (TlsConfig.JAVA_NET_SSL_TLS_CONFIGURATION_NAME.equals(name)) {\n            final TlsConfiguration result = certificates.computeIfAbsent(TlsConfig.JAVA_NET_SSL_TLS_CONFIGURATION_NAME, k -> {\n                final TrustStoreAndTrustOptions ts = JavaxNetSslTrustStoreProvider.getTrustStore(vertx);\n                return new VertxCertificateHolder(vertx, k, runtimeConfig.getValue().namedCertificateConfig().get(k), null, ts);\n            });\n            return Optional.ofNullable(result);\n        }\n        return Optional.ofNullable(certificates.get(name));\n    }\n\n    @Override\n    public Optional<TlsConfiguration> getDefault() {\n        return get(TlsConfig.DEFAULT_NAME);\n    }\n\n    @Override\n    public void register(String name, TlsConfiguration configuration) {\n        if (name == null) {\n            throw new IllegalArgumentException(\"The name of the TLS configuration to register cannot be null\");\n        }\n        if (name.equals(TlsConfig.DEFAULT_NAME)) {\n            throw new IllegalArgumentException(\"The name of the TLS configuration to register cannot be <default>\");\n        }\n        if (name.equals(TlsConfig.JAVA_NET_SSL_TLS_CONFIGURATION_NAME)) {\n            throw new IllegalArgumentException(\n                    \"The TLS configuration name \" + TlsConfig.JAVA_NET_SSL_TLS_CONFIGURATION_NAME\n                            + \" is reserved for providing access to default SunJSSE keystore; neither Quarkus extensions nor end users can adjust of override it\");\n        }\n        if (configuration == null) {\n            throw new IllegalArgumentException(\"The TLS configuration to register cannot be null\");\n        }\n        certificates.put(name, configuration);\n    }\n\n    public Supplier<TlsConfigurationRegistry> getSupplier() {\n        return new Supplier<TlsConfigurationRegistry>() {\n            @Override","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/CertificateRecorder.java#L196-L232","documentation":"TlsConfigurationRegistry.register(name, configuration) requires a non-null name because every registered configuration must be retrievable by name. A null name cannot be resolved later and would corrupt registry lookups, so register() throws IllegalArgumentException immediately.","triggerScenarios":"An extension or application code calls tlsConfigurationRegistry.register(null, configuration), typically when the name is derived from a nullable config value or a variable that was never initialized.","commonSituations":"Custom extensions registering TLS configurations whose name comes from an optional config property that is absent; refactoring where a name constant was replaced by a null-returning lookup.","solutions":["Pass an explicit non-null name, or use the no-arg/default registration path for the default configuration","Null-check or default the config-derived name before calling register (e.g. Objects.requireNonNullElse(name, \"my-tls\"))","If the intent was the default config, call register with a valid name or use the dedicated default accessor instead"],"exampleFix":"// before\nregistry.register(config.name(), configuration); // name() may be null\n// after\nString name = config.name();\nif (name == null) { name = \"my-tls\"; }\nregistry.register(name, configuration);","handlingStrategy":"type-guard","validationCode":"if (name == null || name.isBlank()) {\n    throw new IllegalArgumentException(\"TLS configuration name must be a non-null, non-blank string\");\n}","typeGuard":"static boolean isValidTlsName(String name) {\n    return name != null && !name.isBlank();\n}\n// usage: if (isValidTlsName(name)) { registry.register(name, config); }","tryCatchPattern":"try {\n    registry.register(name, configuration);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"cannot be null\")) {\n        log.error(\"Provide an explicit non-null name for the TLS configuration\", e);\n    } else { throw e; }\n}","preventionTips":["Null-check names derived from optional config before calling register","Use a constant or requireNonNull-defaulted name for registry registrations","Prefer config-driven named TLS configs over programmatic registration when the name may be absent"],"tags":["quarkus","tls","api-misuse","null"],"backgroundTag":"null-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"}