apache/cassandra · warning · UnsupportedOperationException

Cannot return topology when accord.enabled = false in cassan

Error message

Cannot return topology when accord.enabled = false in cassandra.yaml

What it means

SupportAccordService.topology() throws UnsupportedOperationException ('Cannot return topology when accord.enabled = false') because the TopologyManager (Accord's view of range/token ownership) is only constructed when Accord runs. Requesting topology from the stub means the caller assumed Accord metadata exists. The throw prevents callers from dereferencing a null topology.

Source

Thrown at src/java/org/apache/cassandra/service/accord/IAccordService.java:277

            return false;
        }

        @Override
        public long currentEpoch()
        {
            throw new UnsupportedOperationException("Cannot return epoch when accord.enabled = false in cassandra.yaml");
        }

        @Override
        public void setCacheSize(long kb) { }

        @Override
        public void setWorkingSetSize(long kb) {}

        @Override
        public TopologyManager topology()
        {
            throw new UnsupportedOperationException("Cannot return topology when accord.enabled = false in cassandra.yaml");
        }

        @Override
        public void localStartup()
        {
            try
            {
                AccordTopologySorter.checkSnitchSupported(DatabaseDescriptor.getNodeProximity());
            }
            catch (Throwable t)
            {
                logger.warn("Current snitch  is not compatable with Accord, make sure to fix the snitch before enabling Accord; {}", t.toString());
            }
        }

        @Override
        public void stop()
        {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Enable Accord (accord.enabled=true) if topology data is genuinely needed
  2. Gate topology consumers with isEnabled() and fall back to the legacy placement/replication metadata
  3. Refactor the caller to obtain range ownership from StorageService when Accord is disabled
  4. Verify which config file the node loaded; accidental Accord disablement causes this throw

Example fix

// before
TopologyManager tm = accordService.topology();
// after
TopologyManager tm = accordService.isEnabled()
    ? accordService.topology()
    : null; // fall back to legacy replication metadata
Defensive patterns

Strategy: validation

Validate before calling

TopologyManager tm = accordService.isEnabled() ? accordService.topology() : null;

Type guard

TopologyManager topologyIfEnabled(IAccordService s) { return s.isEnabled() ? s.topology() : null; }

Try / catch

try { return accordService.topology(); } catch (UnsupportedOperationException e) { return null; /* use legacy placement */ }

Prevention

When it happens

Trigger: Calling IAccordService.topology() while accord.enabled=false — e.g. range-mapping code, repair tooling, or tests resolving Accord topologies for tokens.

Common situations: Tooling that resolves Accord replicas for a token range runs on a non-Accord node; upgrades where new code always queries topology; mixed clusters where Accord is enabled only in some datacenters.

Related errors


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