{"record":{"id":"c65eeedd8aa5b71c","repo":"apache/cassandra","slug":"s-as-value-of-s-is-invalid-duration-s","errorCode":null,"errorMessage":"%s as value of %s is invalid duration! %s","messagePattern":"(.+?) as value of (.+?) is invalid duration! (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/locator/AbstractCloudMetadataServiceConnector.java","lineNumber":79,"sourceCode":"        }\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        }\n    }\n\n    public SnitchProperties getProperties()\n    {\n        return properties;\n    }\n\n    public final String apiCall(String query) throws IOException\n    {\n        return apiCall(metadataServiceUrl, query, \"GET\", ImmutableMap.of(), 200);\n    }\n\n    public final String apiCall(String query, Map<String, String> extraHeaders) throws IOException\n    {\n        return apiCall(metadataServiceUrl, query, \"GET\", extraHeaders, 200);","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/AbstractCloudMetadataServiceConnector.java#L61-L97","documentation":"Cassandra's cloud metadata connector (used by snitches like Ec2Snitch) reads the `cassandra.metadata_request_timeout` / METADATA_REQUEST_TIMEOUT_PROPERTY setting and parses it as a DurationSpec.IntMillisecondsBound. If the configured string is not a valid duration (wrong unit, non-numeric, negative, or out of range), the spec constructor throws IllegalArgumentException, which is re-wrapped as ConfigurationException with this message. Node startup fails until the property is fixed.","triggerScenarios":"Setting the metadata request timeout property (e.g. -Dcassandra.metadata_request_timeout=abc, or '5x', or '-1ms') so that DurationSpec.IntMillisecondsBound cannot parse it; occurs in the AbstractCloudMetadataServiceConnector constructor at startup.","commonSituations":"Typo in the duration unit (e.g. '500' without unit is rejected in newer versions, '5secs' instead of '5s'), copy-pasted config from an older Cassandra version, or an empty value in cassandra.yaml / JVM options.","solutions":["Fix the property value to a valid duration with an accepted unit, e.g. -Dcassandra.metadata_request_timeout=500ms","Remove the custom property to fall back to the default timeout","Check ex.getMessage() in the error text: it states exactly why parsing failed (unit or range)","Restart the node after correcting the value"],"exampleFix":"// before\ncassandra-env.sh: JVM_OPTS=\"$JVM_OPTS -Dcassandra.metadata_request_timeout=10sec\"\n// after\ncassandra-env.sh: JVM_OPTS=\"$JVM_OPTS -Dcassandra.metadata_request_timeout=10s\"","handlingStrategy":"validation","validationCode":"// Validate before setting the JVM property / yaml value\nString v = System.getProperty(\"cassandra.metadata_request_timeout\", \"\");\nif (!v.isEmpty()) {\n    try {\n        new DurationSpec.IntMillisecondsBound(v);\n    } catch (IllegalArgumentException e) {\n        throw new IllegalArgumentException(\"Bad \" + \"cassandra.metadata_request_timeout\" + \" value: \" + v);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a recognized unit suffix (ms, s, m, h, d) in duration configs","Keep durations positive and within the spec's accepted range","Test cassandra.yaml / jvm-server.options changes on a dev node before rollout"],"tags":["configuration","duration","startup","snitch"],"backgroundTag":"invalid-duration-format","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"}