{"record":{"id":"4b03548a4021ce0d","repo":"apache/cassandra","slug":"unknown-host-specified","errorCode":null,"errorMessage":"Unknown host specified ","messagePattern":"Unknown host specified ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/ActiveRepairService.java","lineNumber":644,"sourceCode":"        {\n            Multimap<String, InetAddressAndPort> dcEndpointsMap = metadata.directory.allDatacenterEndpoints();\n            Iterable<InetAddressAndPort> dcEndpoints = concat(transform(dataCenters, dcEndpointsMap::get));\n            return neighbors.select(dcEndpoints, true);\n        }\n        else if (hosts != null && !hosts.isEmpty())\n        {\n            Set<InetAddressAndPort> specifiedHost = new HashSet<>();\n            for (final String host : hosts)\n            {\n                try\n                {\n                    final InetAddressAndPort endpoint = InetAddressAndPort.getByName(host.trim());\n                    if (endpoint.equals(ctx.broadcastAddressAndPort()) || neighbors.endpoints().contains(endpoint))\n                        specifiedHost.add(endpoint);\n                }\n                catch (UnknownHostException e)\n                {\n                    throw new IllegalArgumentException(\"Unknown host specified \" + host, e);\n                }\n            }\n\n            if (!specifiedHost.contains(ctx.broadcastAddressAndPort()))\n                throw new IllegalArgumentException(\"The current host must be part of the repair\");\n\n            if (specifiedHost.size() <= 1)\n            {\n                String msg = \"Specified hosts %s do not share range %s needed for repair. Either restrict repair ranges \" +\n                             \"with -st/-et options, or specify one of the neighbors that share this range with \" +\n                             \"this node: %s.\";\n                throw new IllegalArgumentException(String.format(msg, hosts, toRepair, neighbors));\n            }\n\n            specifiedHost.remove(ctx.broadcastAddressAndPort());\n            return neighbors.keep(specifiedHost);\n        }\n","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/ActiveRepairService.java#L626-L662","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","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"],"exampleFix":"// before\nnodetool repair keyspace1 -hosts node3,ndoe4   // 'ndoe4' typo\n// after\nnodetool repair keyspace1 -hosts node3,node4","handlingStrategy":"validation","validationCode":"for (String h : hostsArg.split(\",\")) {\n    try { InetAddress.getByName(h.trim()); }\n    catch (UnknownHostException e) { throw new IllegalArgumentException(\"unresolvable host: \" + h); }\n}","typeGuard":null,"tryCatchPattern":"try { repair(...); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown host specified\")) fixHostList(e);\n    throw e;\n}","preventionTips":["Resolve hostnames from the Cassandra node itself before launching repair","Prefer IP literals or verify DNS/hosts entries before topology-dependent operations"],"tags":["dns","repair","hostname-resolution"],"backgroundTag":"invalid-argument-value","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"}