apache/cassandra · warning

Invalid ip address from input=

Error message

Invalid ip address {} from input={}

What it means

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.

Solutions

  1. Fix the offending token in the input string (shown in 'from input=') — correct the IP or hostname spelling.
  2. Ensure seeds are resolvable at startup (DNS available, /etc/hosts entry) or use literal IPs.
  3. Remove empty/duplicate separators (e.g. trailing commas) from the list.
  4. If a hard failure is preferable, call parseHosts with failOnError=true so startup fails fast with the underlying exception.
  5. Verify IPv6 literals are properly formatted when mixed with IPv4.

Example fix

// before
cassandra.yaml: seeds: "10.0.0.1, 10.0.0.300"
// after
cassandra.yaml: seeds: "10.0.0.1,10.0.0.2"  # valid, resolvable IPs without stray separators
Defensive patterns

Strategy: validation

Validate before calling

// validate seed list before handing to Cassandra config
for (String tok : seedsRaw.split("[;,]")) {
    String host = tok.trim();
    if (host.isEmpty()) throw new IllegalArgumentException("empty seed token in: " + seedsRaw);
    try {
        java.net.InetAddress.getByName(host);
    } catch (java.net.UnknownHostException e) {
        throw new IllegalArgumentException("unresolvable seed: " + host + " in " + seedsRaw, e);
    }
}

Type guard

static boolean isValidHostToken(String host) {
    try { java.net.InetAddress.getByName(host.trim()); return true; }
    catch (Exception e) { return false; }
}

Try / catch

try { InetAddressAndPort.parseHosts(value, scope, port, true); }
catch (IllegalArgumentException e) { logger.error("Bad host list {}: {}", value, e.getMessage()); throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/080b4ad57bd8f5fc. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/locator/InetAddressAndPort.java:373

     */
    public static Set<InetAddressAndPort> parseHosts(String value, boolean failOnError)
    {
        Set<InetAddressAndPort> hosts = new HashSet<>();
        for (String host : Splitter.on(',').split(value))
        {
            try
            {
                hosts.add(InetAddressAndPort.getByName(host));
            }
            catch (UnknownHostException e)
            {
                if (failOnError)
                {
                    throw new IllegalArgumentException("Failed to parse host: " + host, e);
                }
                else
                {
                    logger.warn("Invalid ip address {} from input={}", host, value);
                }
            }
        }
        return hosts;
    }

    static int getDefaultPort()
    {
        return defaultPort;
    }

    @Override
    public InetAddressAndPort endpoint()
    {
        return this;
    }

    public static final class MetadataSerializer implements org.apache.cassandra.tcm.serialization.MetadataSerializer<InetAddressAndPort>

View on GitHub (pinned to 88fd0f6a0e)