apache/cassandra · error · IllegalArgumentException

This host was specified as a source for rebuilding. Sources

Error message

This host was specified as a source for rebuilding. Sources for a rebuild can only be other nodes in the cluster.

What it means

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.

Source

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

            }
            else if (tokens == null)
            {
                streamer.addKeyspaceToFetch(keyspace);
            }
            else
            {
                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);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Remove this node's own address/host from the --specific-sources list
  2. Verify resolution: if a hostname unexpectedly resolves to the local address, use the intended peer's IP instead

Example fix

// before
nodetool rebuild --specific-sources 10.0.0.1,10.0.0.2  # 10.0.0.1 is this node
// after
nodetool rebuild --specific-sources 10.0.0.2,10.0.0.3
Defensive patterns

Strategy: validation

Validate before calling

InetAddressAndPort self = StorageService.instance.getBroadcastAddressAndPort();
List<InetAddressAndPort> sources = hosts.stream()
    .map(h -> InetAddressAndPort.getByNameUnchecked(h))
    .filter(ep -> !ep.equals(self))
    .collect(Collectors.toList());

Prevention

When it happens

Trigger: rebuild with specificSources containing this node's own IP:port (resolved via InetAddressAndPort.getByName and compared to getBroadcastAddressAndPort()).

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

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


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