{"record":{"id":"0b13458a0b996079","repo":"apache/cassandra","slug":"this-ec2-enabled-location-provider-appears-to-be-u","errorCode":null,"errorMessage":"This ec2-enabled location provider appears to be using the %s naming scheme for regions, but existing nodes in cluster are using the opposite: region(s) = %s, availability zone(s) = %s. Please check the %s property in the %s configuration file for more details.","messagePattern":"This ec2-enabled location provider appears to be using the (.+?) naming scheme for regions, but existing nodes in cluster are using the opposite: region\\(s\\) = (.+?), availability zone\\(s\\) = (.+?)\\. Please check the (.+?) property in the (.+?) configuration file for more details\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/Ec2LocationProvider.java","lineNumber":151,"sourceCode":"        }\n\n        for (String rack : racks)\n        {\n            // predicated on late-2017 AWS naming 'convention' that AZs do not have a digit as the first char -\n            // we had that in our legacy AZ (rack) names. Thus we test to see if the rack is in the legacy format.\n            //\n            // NOTE: the allowed custom suffix only applies to datacenter (region) names, not availability zones.\n            boolean rackUsesLegacyFormat = rack.matches(\"[\\\\d][a-z]\");\n            if (rackUsesLegacyFormat != usingLegacyNaming)\n            {\n                valid = false;\n                break;\n            }\n        }\n\n        if (!valid)\n        {\n            throw new ConfigurationException(String.format(\"This ec2-enabled location provider appears to be using the \" +\n                                                           \"%s naming scheme for regions, but existing nodes in cluster \" +\n                                                           \"are using the opposite: \" +\n                                                           \"region(s) = %s, availability zone(s) = %s. \" +\n                                                           \"Please check the %s property in the %s configuration file \" +\n                                                           \"for more details.\",\n                                                           usingLegacyNaming ? \"legacy\" : \"standard\", datacenters, racks,\n                                                           SNITCH_PROP_NAMING_SCHEME, SnitchProperties.RACKDC_PROPERTY_FILENAME));\n        }\n        return true;\n    }\n}\n","sourceCodeStart":133,"sourceCodeEnd":163,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/Ec2LocationProvider.java#L133-L163","documentation":"Ec2LocationProvider.validate cross-checks the region/AZ naming scheme the node derived from EC2 metadata (legacy names like us-east-1 vs the standard DNS-suffix scheme) against what existing cluster nodes report. If the schemes conflict it throws ConfigurationException, preventing a node from joining with inconsistent dc/rack naming.","triggerScenarios":"Node starts with ec2_naming_scheme (or derived default) set to one scheme while gossip/cluster metadata shows other nodes' datacenters and racks using the opposite scheme; validate() finds no matching region among the cluster's datacenters.","commonSituations":"Mixed-version cluster after migration from legacy EC2 region naming (pre-4.0) to the new scheme; cloned AMIs with stale cassandra-rackdc.properties; manually edited dc names in cassandra-rackdc.properties not matching the snitch's scheme.","solutions":["Set ec2_naming_scheme in cassandra.yaml to match the existing cluster (legacy or standard)","Align every node's cassandra-rackdc.properties dc/rack values with the chosen scheme","During migration, update nodes one DC at a time so all nodes use the same naming scheme","If names were customized, switch to GossipingPropertyFileSnitch instead of Ec2Snitch"],"exampleFix":"// before (cassandra.yaml)\nendpoint_snitch: Ec2Snitch\n// after\nendpoint_snitch: Ec2Snitch\nec2_naming_scheme: legacy","handlingStrategy":"validation","validationCode":"Set<String> dcs = StorageService.instance.getTokenMetadata().getAllDatacenters();\nString myDc = /* from ec2 metadata */;\nif (!dcs.isEmpty() && !dcs.contains(myDc)) throw new IllegalStateException(\"naming scheme mismatch with cluster dcs: \" + dcs);","typeGuard":null,"tryCatchPattern":"try { node.start(); }\ncatch (ConfigurationException e) { logger.error(\"EC2 naming scheme mismatch: {}\", e.getMessage()); System.exit(1); }","preventionTips":["Standardize ec2_naming_scheme cluster-wide before rolling upgrades","Diff new node dc/rack names against existing cluster datacenters before joining","Avoid hand-editing cassandra-rackdc.properties on EC2 snitch deployments"],"tags":["configuration","ec2","snitch","naming-scheme","cluster-consistency"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}