{"record":{"id":"75a86552ad84df3d","repo":"apache/cassandra","slug":"tried-to-commit-when-in-gossip-mode","errorCode":null,"errorMessage":"Tried to commit when in gossip mode","messagePattern":"Tried to commit when in gossip mode","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/tcm/Commit.java","lineNumber":424,"sourceCode":"                logger.info(\"Responding with full result {} to sender {}\", result, message.from());\n            }\n\n            messagingService.accept(message.responseWith(result), message.from());\n        }\n\n        private void checkCMSState()\n        {\n            switch (cmsStateSupplier.get())\n            {\n                case RESET:\n                case LOCAL:\n                    break;\n                case REMOTE:\n                    throw new NotCMSException(\"Not currently a member of the CMS, can't commit\");\n                case GOSSIP:\n                    String msg = \"Tried to commit when in gossip mode\";\n                    logger.error(msg);\n                    throw new IllegalStateException(msg);\n                default:\n                    throw new IllegalStateException(\"Illegal state: \" + cmsStateSupplier.get());\n            }\n        }\n    }\n\n    public interface Replicator\n    {\n        Replicator NO_OP = (a,b) -> {};\n        void send(Result result, InetAddressAndPort source);\n    }\n\n    public static class DefaultReplicator implements Replicator\n    {\n        public static class RoutingHelper\n        {\n            private final Directory directory;\n            private final EndpointLookup endpoints;","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/Commit.java#L406-L442","documentation":"Commit.checkCMSState validates the sender's ClusterMetadataService state before processing a commit via Commit.doVerb. When the local CMS state is GOSSIP, the node is operating in gossip-based cluster-metadata mode rather than TCM mode, and metadata commits are invalid; the code logs the message via logger.error and throws IllegalStateException. This is an internal-mode invariant check: a TCM commit verb should never arrive (or be processed) while the node is in gossip mode.","triggerScenarios":"A TCM Commit verb is dispatched to doVerb while ClusterMetadataService state resolves to CMSState.GOSSIP (cluster not using TCM / CMS, or the node hasn't been registered as a CMS member); checkCMSState's switch on cmsStateSupplier.get() hits the GOSSIP case at Commit.java:424.","commonSituations":"Clusters migrated from or started in gossip mode receiving stale/misrouted TCM messages; a node whose CMS membership was lost or not yet established handling an in-flight commit; mixed-version rolling upgrade where an old node routes metadata commits to a gossip-mode node.","solutions":["Verify the cluster is running in TCM mode: check ClusterMetadataService state and that the target node is a current CMS member before sending commits.","Ensure all nodes are upgraded and ClusterMetadataService.instance().isCurrentMember(address) is true for the recipient; re-run the CMS placement/registration if membership is missing.","Check for mixed-version or misconfigured nodes routing Commit verbs across mode boundaries; align node versions and retry after the node joins the CMS.","If this appears during a controlled gossip->TCM transition, allow the transition to complete before issuing metadata changes."],"exampleFix":"// guard before sending a commit\nif (ClusterMetadataService.instance().isCurrentMember(FBUtilities.getBroadcastAddressAndPort()))\n{\n    Commit.instance().commit(proposed);\n}\nelse\n{\n    logger.warn(\"Skipping TCM commit: node is not a CMS member (gossip mode)\");\n}","handlingStrategy":"validation","validationCode":"if (ClusterMetadataService.instance().isCurrentMember(FBUtilities.getBroadcastAddressAndPort())\n    && ClusterMetadataService.instance().state() != ClusterMetadataService.CMSState.GOSSIP)\n{\n    Commit.instance().commit(proposed);\n}","typeGuard":null,"tryCatchPattern":"try { Commit.instance().commit(proposed); } catch (IllegalStateException e) { if (e.getMessage().contains(\"gossip mode\")) logger.warn(\"Node in gossip mode; TCM commit rejected\"); else throw e; }","preventionTips":["Confirm the cluster runs in TCM mode before issuing metadata changes","Check isCurrentMember() before sending commits to a peer","Avoid mixing gossip-mode and TCM-mode nodes during upgrades"],"tags":["tcm","gossip-mode","illegal-state","cluster-metadata"],"backgroundTag":"invalid-state-transition","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}