apache/cassandra · error · IllegalArgumentException

Unknown host specified ${stringHost}

Error message

Unknown host specified ${stringHost}

What it means

Each host in --specific-sources is resolved with InetAddressAndPort.getByName; if DNS/hosts-file resolution fails, UnknownHostException is wrapped in an IllegalArgumentException naming the unresolvable host.

Source

Thrown at src/java/org/apache/cassandra/service/Rebuild.java:155

            {
                if (specificSources != null)
                {
                    String[] stringHosts = specificSources.split(",");
                    Set<InetAddressAndPort> sources = new HashSet<>(stringHosts.length);
                    for (String stringHost : stringHosts)
                    {
                        try
                        {
                            InetAddressAndPort endpoint = InetAddressAndPort.getByName(stringHost);
                            if (getBroadcastAddressAndPort().equals(endpoint))
                            {
                                throw new IllegalArgumentException("This host was specified as a source for rebuilding. Sources for a rebuild can only be other nodes in the cluster.");
                            }
                            sources.add(endpoint);
                        }
                        catch (UnknownHostException ex)
                        {
                            throw new IllegalArgumentException("Unknown host specified " + stringHost, ex);
                        }
                    }
                    streamer.addSourceFilter(new RangeStreamer.AllowedSourcesFilter(sources));
                }

                streamer.addKeyspaceToFetch(keyspace);
            }

            StreamResultFuture streamResult = streamer.fetchAsync();

            Future<?> accordReady = AccordService.instance().epochReadyFor(metadata, EpochReady::reads);
            Future<?> ready = FutureCombiner.allOf(streamResult, accordReady);

            // wait for result
            ready.get();
        }
        catch (InterruptedException e)
        {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use IP addresses (with port, e.g. 10.0.0.5:7000) instead of hostnames in --specific-sources
  2. Fix DNS or add the peer to /etc/hosts, then retry
  3. Remove entries for decommissioned nodes from the source list

Example fix

// before
nodetool rebuild --specific-sources cassandra-node7.internal
// after (DNS broken; use IP)
nodetool rebuild --specific-sources 10.0.0.7:7000
Defensive patterns

Strategy: validation

Validate before calling

for (String h : hosts)
    try { InetAddressAndPort.getByName(h); }
    catch (UnknownHostException e) { throw new IllegalArgumentException("unresolvable host in sources: " + h); }

Try / catch

try { rebuild(...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unknown host specified")) retryWithoutHost(e); else throw e; }

Prevention

When it happens

Trigger: rebuild with specificSources containing a hostname that cannot be resolved to an IP address.

Common situations: Typo in hostname; DNS outage or missing /etc/hosts entry on the node; stale hostname of a decommissioned node; using a name only resolvable in another datacenter's DNS zone.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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