{"record":{"id":"83e6d6c788ec35dd","repo":"apache/cassandra","slug":"snitch-metadata-service-url-s-is-invalid-pleas","errorCode":null,"errorMessage":"Snitch metadata service URL '%s' is invalid. Please review snitch properties defined in the configured '%s' configuration file.","messagePattern":"Snitch metadata service URL '(.+?)' is invalid\\. Please review snitch properties defined in the configured '(.+?)' configuration file\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/locator/AbstractCloudMetadataServiceConnector.java","lineNumber":64,"sourceCode":"    protected final int requestTimeoutMs;\n\n    private final SnitchProperties properties;\n\n    public AbstractCloudMetadataServiceConnector(SnitchProperties snitchProperties)\n    {\n        this.properties = snitchProperties;\n        String parsedMetadataServiceUrl = properties.get(METADATA_URL_PROPERTY, null);\n\n        try\n        {\n            URL url = new URL(parsedMetadataServiceUrl);\n            url.toURI();\n\n            this.metadataServiceUrl = parsedMetadataServiceUrl;\n        }\n        catch (MalformedURLException | IllegalArgumentException | URISyntaxException ex)\n        {\n            throw new ConfigurationException(format(\"Snitch metadata service URL '%s' is invalid. Please review snitch properties \" +\n                                                    \"defined in the configured '%s' configuration file.\",\n                                                    parsedMetadataServiceUrl,\n                                                    CassandraRelevantProperties.CASSANDRA_RACKDC_PROPERTIES.getKey()),\n                                             ex);\n        }\n\n        String metadataRequestTimeout = properties.get(METADATA_REQUEST_TIMEOUT_PROPERTY, DEFAULT_METADATA_REQUEST_TIMEOUT);\n\n        try\n        {\n            this.requestTimeoutMs = new DurationSpec.IntMillisecondsBound(metadataRequestTimeout).toMilliseconds();\n        }\n        catch (IllegalArgumentException ex)\n        {\n            throw new ConfigurationException(format(\"%s as value of %s is invalid duration! \" + ex.getMessage(),\n                                                    metadataRequestTimeout,\n                                                    METADATA_REQUEST_TIMEOUT_PROPERTY));\n        }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/AbstractCloudMetadataServiceConnector.java#L46-L82","documentation":"AbstractCloudMetadataServiceConnector validates the configured metadata service URL by converting it to a URI. Malformed URLs (MalformedURLException, URISyntaxException, or IllegalArgumentException) raise a ConfigurationException pointing at cassandra-rackdc.properties, since cloud snitches (EC2/GCE/Azure) fetch topology from that service.","triggerScenarios":"Startup of an EC2Snitch/Ec2MultiRegionSnitch/GceSnitch or similar where the metadata service URL property in cassandra-rackdc.properties is malformed (missing scheme, illegal characters, spaces, bad port).","commonSituations":"Typo'd or hand-edited cassandra-rackdc.properties; overriding metadata_service_url with an internal endpoint and missing 'http://'; shell interpolation leaving placeholders like ${HOST} unresolved.","solutions":["Fix the metadata service URL property in cassandra-rackdc.properties to a fully qualified, valid absolute URI (e.g. http://169.254.169.254)","Remove stray spaces, quotes, or unexpanded environment placeholders from the property","Verify the property key name matches what your snitch version expects","Test the URL with a URI validator or `new URI(...)`/curl before restarting Cassandra"],"exampleFix":"// before (cassandra-rackdc.properties)\nec2_metadata_service_url=169.254.169.254/latest\n// after\nec2_metadata_service_url=http://169.254.169.254/latest","handlingStrategy":"validation","validationCode":"String url = props.getProperty(\"ec2_metadata_service_url\");\ntry { new java.net.URI(url).toURL(); } catch (Exception e) { failStartup(\"invalid metadata service url: \" + url); }","typeGuard":"boolean validUrl(String s) { try { new java.net.URI(s).toURL(); return true; } catch (Exception e) { return false; } }","tryCatchPattern":"try { startSnitch(); } catch (ConfigurationException e) { log.error(\"check {} : {}\", cassandraRackdcFile, e.getMessage()); System.exit(1); }","preventionTips":["Always include the scheme (http://) in metadata service URLs","Avoid environment placeholder expansion in cassandra-rackdc.properties","Validate rackdc properties with config tooling before rollout","Test snitch config changes in staging with the same properties file"],"tags":["configuration","url","snitch","startup"],"backgroundTag":"invalid-config-value","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"}