{"record":{"id":"a9d6e23440d2e689","repo":"apache/cassandra","slug":"cannot-return-epoch-when-accord-enabled-false-in","errorCode":null,"errorMessage":"Cannot return epoch when accord.enabled = false in cassandra.yaml","messagePattern":"Cannot return epoch 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":265,"sourceCode":"            return List.of();\n        }\n\n        @Override\n        public @Nonnull IAccordResult<TxnResult> coordinateAsync(long minEpoch, long minHlc, @Nonnull Txn txn, @Nonnull ConsistencyLevel consistencyLevel, RequestTime requestTime)\n        {\n            throw new UnsupportedOperationException(\"No accord transaction should be executed when accord.enabled = false in cassandra.yaml\");\n        }\n\n        @Override\n        public boolean isEnabled()\n        {\n            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","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/IAccordService.java#L247-L283","documentation":"SupportAccordService.currentEpoch() throws UnsupportedOperationException ('Cannot return epoch when accord.enabled = false') because the Accord topology epoch only exists when Accord is running. Without Accord there is no epoch source, so the stub refuses to return a value rather than returning misleading data like 0.","triggerScenarios":"Calling IAccordService.currentEpoch() on a node with accord.enabled=false, e.g. from JMX/monitoring, node-tool output, or internal code computing Accord timestamps.","commonSituations":"Monitoring dashboards scraping Accord epoch metrics on clusters where Accord was never enabled; health checks that unconditionally query currentEpoch; config change disabling Accord while epoch-based logic still runs.","solutions":["Check isEnabled() before reading currentEpoch and report ' Accord disabled' instead of calling","Enable Accord in cassandra.yaml if epoch reporting is required","Update monitoring/health-check code to treat a disabled Accord as a valid state, not an error path","Capture the UnsupportedOperationException and degrade the metric gracefully"],"exampleFix":"// before\nlong epoch = accordService.currentEpoch();\n// after\nlong epoch = accordService.isEnabled() ? accordService.currentEpoch() : -1;","handlingStrategy":"fallback","validationCode":"long epoch = accordService.isEnabled() ? accordService.currentEpoch() : -1;","typeGuard":"Long safeCurrentEpoch(IAccordService s) { return s.isEnabled() ? s.currentEpoch() : null; }","tryCatchPattern":"try { return accordService.currentEpoch(); } catch (UnsupportedOperationException e) { return -1L; }","preventionTips":["Treat 'Accord disabled' as valid state in monitoring, not an error","Guard epoch readers with isEnabled()","Use a sentinel value (e.g. -1) for epoch when Accord is off","Avoid unconditional epoch queries in shared health-check code"],"tags":["accord","cassandra","epoch","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"}