{"record":{"id":"a9f13f5c237e7bd0","repo":"apache/cassandra","slug":"could-not-initialize-cms-lookup","errorCode":null,"errorMessage":"Could not initialize CMS lookup","messagePattern":"Could not initialize CMS lookup","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/tcm/Startup.java","lineNumber":388,"sourceCode":"                        logger.info(\"Added override for {}, ({} -> {})\", confirmed, prev, next);\n                        builder = builder.withOverride(confirmed, prev, next);\n                    }\n                }\n\n                if (!builder.hasOverrides())\n                {\n                    logger.info(\"No overrides required for CMS members\");\n                    return replayed;\n                }\n\n                if (replayed.initCMSLookup(builder.build()))\n                {\n                    logger.info(\"Adding CMS lookup log listener\");\n                    ClusterMetadataService.instance().log().addListener(new CMSLookup.LogListener());\n                    return replayed;\n                }\n                else\n                    throw new RuntimeException(\"Could not initialize CMS lookup\");\n            }\n        }\n        else\n        {\n            throw new RuntimeException(String.format(\"Unable to identify a quorum of CMS members (found %s, required %s). \" +\n                                                     \"If attemping rediscovery after multiple endpoint changes, check that\" +\n                                                     \"seeds have been correctly updated.\",\n                                                     confirmedCMS.size(), quorum));\n        }\n    }\n\n    public static void scrubDataDirectories(ClusterMetadata metadata) throws StartupException\n    {\n        // clean up debris in the rest of the keyspaces\n        for (KeyspaceMetadata keyspace : metadata.schema.getKeyspaces())\n        {\n            // Skip system as we've already cleaned it\n            if (keyspace.name.equals(SchemaConstants.SYSTEM_KEYSPACE_NAME) || keyspace.name.equals(SchemaConstants.ACCORD_KEYSPACE_NAME))","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/Startup.java#L370-L406","documentation":"Startup.initializeCMSLookup verifies, after replaying the log and adding the CMS lookup LogListener, that the replayed metadata allows the CMS lookup to be initialized. If the replayed ClusterMetadata does not satisfy the expected conditions (the replayed epoch/membership cannot establish the CMS lookup), it throws RuntimeException 'Could not initialize CMS lookup'. This aborts startup because the node cannot resolve which nodes constitute the Cluster Metadata Service.","triggerScenarios":"initializeCMSLookup replays the metadata log, adds CMSLookup.LogListener, but the post-replay state does not yield a resolvable CMS configuration, hitting the else branch that throws.","commonSituations":"Corrupted or incomplete TCM log replay; the cluster's CMS membership in the replayed metadata is empty/inconsistent; partial log segments after a crash; mixing nodes with incompatible TCM log formats.","solutions":["Inspect the TCM log replay output/logs to see why the replayed metadata could not establish the CMS lookup.","Verify the CMS members recorded in the metadata are current, reachable nodes (nodetool cms show).","If log segments are corrupt, restore from a consistent backup or re-bootstrap the node from seeds.","Ensure all nodes run compatible Cassandra versions with matching TCM log serialization.","Retry startup once the CMS quorum is healthy and the log is intact."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { Startup.initializeCMSLookup(...); }\ncatch (RuntimeException e) {\n    if (\"Could not initialize CMS lookup\".equals(e.getMessage())) {\n        // verify log integrity and CMS membership, then retry after operator intervention\n    } else throw e;\n}","preventionTips":["Back up TCM log segments and validate them after crashes","Keep all nodes on compatible Cassandra versions","Verify CMS membership health before restarting nodes","Restore nodes from consistent snapshots only"],"tags":["tcm","cms","startup","log-replay"],"backgroundTag":"internal-invariant-violation","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"}