{"record":{"id":"1a28f544e9a9a181","repo":"apache/cassandra","slug":"this-host-was-specified-as-a-source-for-rebuilding","errorCode":null,"errorMessage":"This host was specified as a source for rebuilding. Sources for a rebuild can only be other nodes in the cluster.","messagePattern":"This host was specified as a source for rebuilding\\. Sources for a rebuild can only be other nodes in the cluster\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/Rebuild.java","lineNumber":149,"sourceCode":"            }\n            else if (tokens == null)\n            {\n                streamer.addKeyspaceToFetch(keyspace);\n            }\n            else\n            {\n                if (specificSources != null)\n                {\n                    String[] stringHosts = specificSources.split(\",\");\n                    Set<InetAddressAndPort> sources = new HashSet<>(stringHosts.length);\n                    for (String stringHost : stringHosts)\n                    {\n                        try\n                        {\n                            InetAddressAndPort endpoint = InetAddressAndPort.getByName(stringHost);\n                            if (getBroadcastAddressAndPort().equals(endpoint))\n                            {\n                                throw new IllegalArgumentException(\"This host was specified as a source for rebuilding. Sources for a rebuild can only be other nodes in the cluster.\");\n                            }\n                            sources.add(endpoint);\n                        }\n                        catch (UnknownHostException ex)\n                        {\n                            throw new IllegalArgumentException(\"Unknown host specified \" + stringHost, ex);\n                        }\n                    }\n                    streamer.addSourceFilter(new RangeStreamer.AllowedSourcesFilter(sources));\n                }\n\n                streamer.addKeyspaceToFetch(keyspace);\n            }\n\n            StreamResultFuture streamResult = streamer.fetchAsync();\n\n            Future<?> accordReady = AccordService.instance().epochReadyFor(metadata, EpochReady::reads);\n            Future<?> ready = FutureCombiner.allOf(streamResult, accordReady);","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/Rebuild.java#L131-L167","documentation":"When --specific-sources lists hosts to stream from, each is resolved and compared to this node's broadcast address/port; listing the local node as its own source is invalid because a node cannot rebuild data from itself.","triggerScenarios":"rebuild with specificSources containing this node's own IP:port (resolved via InetAddressAndPort.getByName and compared to getBroadcastAddressAndPort()).","commonSituations":"Copy-pasting a host list template that still contains the local node's address; generating source lists from a script that includes all cluster nodes; hostname resolving to the local address (e.g. localhost or the node's own DNS entry).","solutions":["Remove this node's own address/host from the --specific-sources list","Verify resolution: if a hostname unexpectedly resolves to the local address, use the intended peer's IP instead"],"exampleFix":"// before\nnodetool rebuild --specific-sources 10.0.0.1,10.0.0.2  # 10.0.0.1 is this node\n// after\nnodetool rebuild --specific-sources 10.0.0.2,10.0.0.3","handlingStrategy":"validation","validationCode":"InetAddressAndPort self = StorageService.instance.getBroadcastAddressAndPort();\nList<InetAddressAndPort> sources = hosts.stream()\n    .map(h -> InetAddressAndPort.getByNameUnchecked(h))\n    .filter(ep -> !ep.equals(self))\n    .collect(Collectors.toList());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate --specific-sources lists excluding the local node's broadcast address and hostname","Resolve hostnames to IPs first and filter self before passing","Review scripts that enumerate cluster members for source lists"],"tags":["arguments","rebuild","network","self-reference"],"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-14T21:17:11.552Z"}