apache/cassandra · error · IllegalArgumentException
Unknown host specified
Error message
Unknown host specified
What it means
filterNeighbors parses the user-supplied -hosts list; each entry must resolve via InetAddressAndPort.getByName. When a hostname cannot be resolved or an IP is malformed, UnknownHostException is caught and rethrown as IllegalArgumentException naming the offending host string.
Solutions
- Correct the hostname/IP in the -hosts argument
- Verify DNS resolution from the Cassandra node (ping/nslookup the host)
- Use numeric IP:port pairs instead of hostnames to bypass DNS
Example fix
// before nodetool repair keyspace1 -hosts node3,ndoe4 // 'ndoe4' typo // after nodetool repair keyspace1 -hosts node3,node4
Defensive patterns
Strategy: validation
Validate before calling
for (String h : hostsArg.split(",")) {
try { InetAddress.getByName(h.trim()); }
catch (UnknownHostException e) { throw new IllegalArgumentException("unresolvable host: " + h); }
} Try / catch
try { repair(...); }
catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown host specified")) fixHostList(e);
throw e;
} Prevention
- Resolve hostnames from the Cassandra node itself before launching repair
- Prefer IP literals or verify DNS/hosts entries before topology-dependent operations
When it happens
Trigger: Running nodetool repair -hosts with a hostname that does not resolve in DNS/hosts file, an IP typo, or a hostname with trailing/odd whitespace beyond trim().
Common situations: DNS outages or stale /etc/hosts entries during repair automation; copy-paste of hostnames including typos; specifying hostnames in a container environment where they don't resolve.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Unable to look up endpoint
- A repair_session_space of
- A repair_session_space of
- An incremental repair with session id
- Auto-repair scheduler is disabled.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/4b03548a4021ce0d.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/service/ActiveRepairService.java:644
{
Multimap<String, InetAddressAndPort> dcEndpointsMap = metadata.directory.allDatacenterEndpoints();
Iterable<InetAddressAndPort> dcEndpoints = concat(transform(dataCenters, dcEndpointsMap::get));
return neighbors.select(dcEndpoints, true);
}
else if (hosts != null && !hosts.isEmpty())
{
Set<InetAddressAndPort> specifiedHost = new HashSet<>();
for (final String host : hosts)
{
try
{
final InetAddressAndPort endpoint = InetAddressAndPort.getByName(host.trim());
if (endpoint.equals(ctx.broadcastAddressAndPort()) || neighbors.endpoints().contains(endpoint))
specifiedHost.add(endpoint);
}
catch (UnknownHostException e)
{
throw new IllegalArgumentException("Unknown host specified " + host, e);
}
}
if (!specifiedHost.contains(ctx.broadcastAddressAndPort()))
throw new IllegalArgumentException("The current host must be part of the repair");
if (specifiedHost.size() <= 1)
{
String msg = "Specified hosts %s do not share range %s needed for repair. Either restrict repair ranges " +
"with -st/-et options, or specify one of the neighbors that share this range with " +
"this node: %s.";
throw new IllegalArgumentException(String.format(msg, hosts, toRepair, neighbors));
}
specifiedHost.remove(ctx.broadcastAddressAndPort());
return neighbors.keep(specifiedHost);
}
View on GitHub (pinned to 88fd0f6a0e)