apache/cassandra · error · UnsupportedOperationException

IEndpointSnitch has been deprecated and is no longer in use

Error message

IEndpointSnitch has been deprecated and is no longer in use

What it means

AbstractEndpointSnitch.getRack unconditionally throws UnsupportedOperationException because the legacy IEndpointSnitch rack/DC API has been removed. Rack and datacenter resolution now goes through the peer metadata / ClusterMetadata layer instead of snitches. Any code (or custom code) still calling getRack on an AbstractEndpointSnitch will always fail.

Solutions

  1. Replace getRack calls with ClusterMetadata / LocationSubplanes lookups (e.g. ClusterMetadata.current().location(endpoint))
  2. Update custom snitch implementations to extend the current snitch base classes and RackDc interfaces
  3. If rack/DC is needed in tooling, read it from system.peers_v2 / gossip info instead of the snitch
  4. Upgrade dependent code to the 4.0+ locator API

Example fix

// before
String rack = snitch.getRack(endpoint);
// after
String rack = ClusterMetadata.current().location(endpoint).rack;
Defensive patterns

Strategy: type-guard

Validate before calling

// Never call the deprecated method; resolve topology via cluster metadata
String rack = ClusterMetadata.current().location(endpoint).rack;

Type guard

function usesLegacySnitchApi(Object snitch) {
    return snitch instanceof AbstractEndpointSnitch; // getRack/getDatacenter will throw
}

Prevention

When it happens

Trigger: Calling snitch.getRack(endpoint) on an instance of AbstractEndpointSnitch, or running custom/plugin code written against the pre-4.0 IEndpointSnitch API.

Common situations: Third-party plugins or monitoring hooks migrated from Cassandra 3.x that query the snitch for rack info; application code copying old examples that used IEndpointSnitch.getDatacenter/getRack.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java:36

package org.apache.cassandra.locator;

import com.google.common.collect.Iterables;

import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.tcm.membership.Location;

/**
 * @deprecated
 */
@Deprecated(since = "CEP-21")
public abstract class AbstractEndpointSnitch implements IEndpointSnitch
{
    public abstract int compareEndpoints(InetAddressAndPort target, Replica r1, Replica r2);

    @Override
    public String getRack(InetAddressAndPort endpoint)
    {
        throw new UnsupportedOperationException("IEndpointSnitch has been deprecated and is no longer in use");
    }

    @Override
    public String getDatacenter(InetAddressAndPort endpoint)
    {
        throw new UnsupportedOperationException("IEndpointSnitch has been deprecated and is no longer in use");
    }

    /**
     * Sorts the <tt>Collection</tt> of node addresses by proximity to the given address
     * @param address the address to sort by proximity to
     * @param unsortedAddress the nodes to sort
     * @return a new sorted <tt>List</tt>
     */
    public <C extends ReplicaCollection<? extends C>> C sortedByProximity(final InetAddressAndPort address, C unsortedAddress)
    {
        return unsortedAddress.sorted((r1, r2) -> compareEndpoints(address, r1, r2));
    }

View on GitHub (pinned to 88fd0f6a0e)