{"record":{"id":"080b4ad57bd8f5fc","repo":"apache/cassandra","slug":"invalid-ip-address-from-input","errorCode":null,"errorMessage":"Invalid ip address {} from input={}","messagePattern":"Invalid ip address (.+?) from input=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/locator/InetAddressAndPort.java","lineNumber":373,"sourceCode":"     */\n    public static Set<InetAddressAndPort> parseHosts(String value, boolean failOnError)\n    {\n        Set<InetAddressAndPort> hosts = new HashSet<>();\n        for (String host : Splitter.on(',').split(value))\n        {\n            try\n            {\n                hosts.add(InetAddressAndPort.getByName(host));\n            }\n            catch (UnknownHostException e)\n            {\n                if (failOnError)\n                {\n                    throw new IllegalArgumentException(\"Failed to parse host: \" + host, e);\n                }\n                else\n                {\n                    logger.warn(\"Invalid ip address {} from input={}\", host, value);\n                }\n            }\n        }\n        return hosts;\n    }\n\n    static int getDefaultPort()\n    {\n        return defaultPort;\n    }\n\n    @Override\n    public InetAddressAndPort endpoint()\n    {\n        return this;\n    }\n\n    public static final class MetadataSerializer implements org.apache.cassandra.tcm.serialization.MetadataSerializer<InetAddressAndPort>","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/InetAddressAndPort.java#L355-L391","documentation":"InetAddressAndPort.parseHosts splits a comma/semicolon-separated address list and attempts to parse each entry; when one entry cannot be parsed and failOnError is false, it logs this warning naming the bad token (host) and the raw input string, then skips it. Callers that pass failOnError=true instead get an IllegalArgumentException. It means one of the supplied host strings was not a valid IP literal or resolvable address.","triggerScenarios":"Calling parseHosts(value, scope, port, failOnError=false) with input containing an unresolvable hostname, malformed IP (e.g. '10.0.0.300'), or empty tokens (e.g. 'seed,,10.0.0.2') from stray separators.","commonSituations":"cassandra.yaml seed_provider (SimpleSeedProvider) seeds list with a typo or DNS name unreachable at startup; environment-substituted seed lists leaving an empty entry; copy-pasted seeds with wrong values.","solutions":["Fix the offending token in the input string (shown in 'from input=') — correct the IP or hostname spelling.","Ensure seeds are resolvable at startup (DNS available, /etc/hosts entry) or use literal IPs.","Remove empty/duplicate separators (e.g. trailing commas) from the list.","If a hard failure is preferable, call parseHosts with failOnError=true so startup fails fast with the underlying exception.","Verify IPv6 literals are properly formatted when mixed with IPv4."],"exampleFix":"// before\ncassandra.yaml: seeds: \"10.0.0.1, 10.0.0.300\"\n// after\ncassandra.yaml: seeds: \"10.0.0.1,10.0.0.2\"  # valid, resolvable IPs without stray separators","handlingStrategy":"validation","validationCode":"// validate seed list before handing to Cassandra config\nfor (String tok : seedsRaw.split(\"[;,]\")) {\n    String host = tok.trim();\n    if (host.isEmpty()) throw new IllegalArgumentException(\"empty seed token in: \" + seedsRaw);\n    try {\n        java.net.InetAddress.getByName(host);\n    } catch (java.net.UnknownHostException e) {\n        throw new IllegalArgumentException(\"unresolvable seed: \" + host + \" in \" + seedsRaw, e);\n    }\n}","typeGuard":"static boolean isValidHostToken(String host) {\n    try { java.net.InetAddress.getByName(host.trim()); return true; }\n    catch (Exception e) { return false; }\n}","tryCatchPattern":"try { InetAddressAndPort.parseHosts(value, scope, port, true); }\ncatch (IllegalArgumentException e) { logger.error(\"Bad host list {}: {}\", value, e.getMessage()); throw e; }","preventionTips":["Use literal IPs or guaranteed-resolvable DNS names in seed lists.","Pass failOnError=true in critical paths so bad config fails fast.","Trim and remove empty tokens when building lists programmatically.","Validate config at deploy time, before node startup."],"tags":["network","ip-address","parsing","configuration"],"backgroundTag":"invalid-ip-address","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}