{"record":{"id":"6e0d4b8bbc780595","repo":"apache/cassandra","slug":"cannot-return-topology-when-accord-enabled-false","errorCode":null,"errorMessage":"Cannot return topology when accord.enabled = false in cassandra.yaml","messagePattern":"Cannot return topology when accord\\.enabled = false in cassandra\\.yaml","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/accord/IAccordService.java","lineNumber":277,"sourceCode":"            return false;\n        }\n\n        @Override\n        public long currentEpoch()\n        {\n            throw new UnsupportedOperationException(\"Cannot return epoch when accord.enabled = false in cassandra.yaml\");\n        }\n\n        @Override\n        public void setCacheSize(long kb) { }\n\n        @Override\n        public void setWorkingSetSize(long kb) {}\n\n        @Override\n        public TopologyManager topology()\n        {\n            throw new UnsupportedOperationException(\"Cannot return topology when accord.enabled = false in cassandra.yaml\");\n        }\n\n        @Override\n        public void localStartup()\n        {\n            try\n            {\n                AccordTopologySorter.checkSnitchSupported(DatabaseDescriptor.getNodeProximity());\n            }\n            catch (Throwable t)\n            {\n                logger.warn(\"Current snitch  is not compatable with Accord, make sure to fix the snitch before enabling Accord; {}\", t.toString());\n            }\n        }\n\n        @Override\n        public void stop()\n        {","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/IAccordService.java#L259-L295","documentation":"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.","triggerScenarios":"Calling IAccordService.topology() while accord.enabled=false — e.g. range-mapping code, repair tooling, or tests resolving Accord topologies for tokens.","commonSituations":"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.","solutions":["Enable Accord (accord.enabled=true) if topology data is genuinely needed","Gate topology consumers with isEnabled() and fall back to the legacy placement/replication metadata","Refactor the caller to obtain range ownership from StorageService when Accord is disabled","Verify which config file the node loaded; accidental Accord disablement causes this throw"],"exampleFix":"// before\nTopologyManager tm = accordService.topology();\n// after\nTopologyManager tm = accordService.isEnabled()\n    ? accordService.topology()\n    : null; // fall back to legacy replication metadata","handlingStrategy":"validation","validationCode":"TopologyManager tm = accordService.isEnabled() ? accordService.topology() : null;","typeGuard":"TopologyManager topologyIfEnabled(IAccordService s) { return s.isEnabled() ? s.topology() : null; }","tryCatchPattern":"try { return accordService.topology(); } catch (UnsupportedOperationException e) { return null; /* use legacy placement */ }","preventionTips":["Resolve range ownership from StorageService when Accord is disabled","Check isEnabled() before any topology consumer","Enable Accord on nodes whose tooling requires topology data","Handle null topology explicitly in callers"],"tags":["accord","cassandra","topology","unsupported-operation"],"backgroundTag":"feature-not-enabled","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}