{"record":{"id":"865f2ad3bb627ede","repo":"apache/cassandra","slug":"unable-to-resolve-initial-location-using-cloud-met","errorCode":null,"errorMessage":"Unable to resolve initial location using cloud metadata service connector","messagePattern":"Unable to resolve initial location using cloud metadata service connector","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/CloudMetadataLocationProvider.java","lineNumber":58,"sourceCode":"    {\n        this.connector = connector;\n        this.locationResolver = locationResolver;\n    }\n\n    @Override\n    public final Location initialLocation()\n    {\n        if (location == null)\n        {\n            try\n            {\n                location = locationResolver.resolve(connector);\n                logger.info(format(\"%s using datacenter: %s, rack: %s, connector: %s, properties: %s\",\n                                   getClass().getName(), location.datacenter, location.rack, connector, connector.getProperties()));\n            }\n            catch (IOException e)\n            {\n                throw new ConfigurationException(\"Unable to resolve initial location using cloud metadata service connector\", e);\n            }\n        }\n        return location;\n    }\n\n    public interface LocationResolver\n    {\n        Location resolve(AbstractCloudMetadataServiceConnector connector) throws IOException;\n    }\n}\n","sourceCodeStart":40,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/CloudMetadataLocationProvider.java#L40-L69","documentation":"Thrown by CloudMetadataLocationProvider.initialLocation() when the cloud metadata connector's I/O fails (IOException) while resolving the node's location, wrapped as a ConfigurationException. The node cannot determine its datacenter/rack from the cloud metadata service, which is required for snitch-based placement.","triggerScenarios":"initialLocation() during node startup when connector.apiCall/resolve throws IOException — metadata service unreachable, timeout, HTTP error, or DNS failure.","commonSituations":"Node not running in the expected cloud (no metadata endpoint at 169.254.169.254); firewall/iptables blocking link-local traffic; network flakiness at boot; wrong endpoint override in cassandra.yaml.","solutions":["Verify the metadata service endpoint is reachable from the node (curl the connector URL)","Check firewall rules allow access to the link-local metadata address","Correct the cassandra.yaml connector endpoint/timeout properties","Fall back to configuring datacenter/rack manually (e.g. use a non-cloud snitch with cassandra-rackdc.properties)"],"exampleFix":"// before\ncassandra.cloud_metadata_service_endpoint: http://169.254.169.254/wrong/path\n\n// after\ncassandra.cloud_metadata_service_endpoint: http://169.254.169.254/latest/meta-data/placement/availability-zone","handlingStrategy":"try-catch","validationCode":"// reachability check before startup\nnew URL(endpoint).openConnection().setConnectTimeout(2000); // succeeds => metadata service reachable","typeGuard":null,"tryCatchPattern":"try { return provider.initialLocation(connector); } catch (ConfigurationException e) { logger.error(\"Cloud metadata unreachable ({})\", e.getCause()); throw e; }","preventionTips":["Add metadata endpoint to startup healthchecks","Allow link-local 169.254.169.254 in firewall/iptables","Set sane connector timeouts and retry at boot","Have a non-cloud snitch fallback documented"],"tags":["cloud-metadata","network","snitch","startup"],"backgroundTag":"http-request-failed","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"}