{"record":{"id":"bea99863e3596441","repo":"apache/kafka","slug":"no-resolvable-bootstrap-urls-given-in-bootstrap-se","errorCode":null,"errorMessage":"No resolvable bootstrap urls given in bootstrap.servers","messagePattern":"No resolvable bootstrap urls given in bootstrap\\.servers","errorType":"validation","errorClass":"ConfigException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/ClientUtils.java","lineNumber":141,"sourceCode":"        for (String url : urls) {\n            if (url != null && !url.isEmpty()) {\n                try {\n                    String host = getHost(url);\n                    Integer port = getPort(url);\n                    if (host == null || port == null)\n                        throw new ConfigException(\"Invalid url in \" + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + \": \" + url);\n\n                    addresses.addAll(resolveAddress(url, host, port, clientDnsLookup));\n\n                } catch (IllegalArgumentException e) {\n                    throw new ConfigException(\"Invalid port in \" + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + \": \" + url);\n                } catch (UnknownHostException e) {\n                    throw new ConfigException(\"Unknown host in \" + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + \": \" + url);\n                }\n            }\n        }\n        if (addresses.isEmpty())\n            throw new ConfigException(\"No resolvable bootstrap urls given in \" + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG);\n        return addresses;\n    }\n\n    /**\n     * Create a new channel builder from the provided configuration.\n     *\n     * @param config client configs\n     * @param time the time implementation\n     * @param logContext the logging context\n     *\n     * @return configured ChannelBuilder based on the configs.\n     */\n    public static ChannelBuilder createChannelBuilder(AbstractConfig config, Time time, LogContext logContext) {\n        SecurityProtocol securityProtocol = SecurityProtocol.forName(config.getString(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG));\n        String clientSaslMechanism = config.getString(SaslConfigs.SASL_MECHANISM);\n        return ChannelBuilders.clientChannelBuilder(securityProtocol, JaasContext.Type.CLIENT, config, null,\n                clientSaslMechanism, time, logContext);\n    }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/ClientUtils.java#L123-L159","documentation":"ConfigException from ClientUtils.parseAndValidateAddresses when, after iterating all urls, the resolved addresses list is empty. This means every entry was null/empty, or all entries failed to produce any InetSocketAddress (e.g. all filtered out). Distinct from per-entry errors — this fires when nothing survived the loop at all.","triggerScenarios":"addresses.isEmpty() at line 141 after the for loop. Triggered when the bootstrap.servers list contains only blank/null entries, or when clientDnsLookup filtering removed every address.","commonSituations":"bootstrap.servers is empty or whitespace-only; value comes from an unset environment variable; trailing comma yields a single blank entry; every entry was filtered by a custom clientDnsLookup mode.","solutions":["Set bootstrap.servers to at least one resolvable host:port.","Strip blanks and trailing commas before constructing the client.","Check the source of the value (env var, config file) is populated.","If using clientDnsLookup=use_all_dns_addresses, ensure at least one host has an A/AAAA record."],"exampleFix":"# before\nbootstrap.servers=   \n# after\nbootstrap.servers=broker1:9092,broker2:9092","handlingStrategy":"validation","validationCode":"List<String> effective = urls.stream().filter(u -> u != null && !u.trim().isEmpty()).toList();\nif (effective.isEmpty()) throw new IllegalArgumentException(\"bootstrap.servers has no non-empty entries\");","typeGuard":null,"tryCatchPattern":"try { ClientUtils.parseAndValidateAddresses(urls, dns); } catch (ConfigException e) { if (e.message.contains(\"No resolvable bootstrap urls\")) { /* populate bootstrap.servers */ } else throw e; }","preventionTips":["Never leave bootstrap.servers empty or whitespace-only.","Confirm the env var / config source is set.","Trim blanks and trailing commas before passing the list."],"tags":["kafka-client","config","bootstrap","network"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}