apache/cassandra · critical · ConfigurationException
%s as value of %s is invalid duration! %s
Error message
%s as value of %s is invalid duration! %s
What it means
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.
Source
Thrown at src/java/org/apache/cassandra/locator/AbstractCloudMetadataServiceConnector.java:79
}
catch (MalformedURLException | IllegalArgumentException | URISyntaxException ex)
{
throw new ConfigurationException(format("Snitch metadata service URL '%s' is invalid. Please review snitch properties " +
"defined in the configured '%s' configuration file.",
parsedMetadataServiceUrl,
CassandraRelevantProperties.CASSANDRA_RACKDC_PROPERTIES.getKey()),
ex);
}
String metadataRequestTimeout = properties.get(METADATA_REQUEST_TIMEOUT_PROPERTY, DEFAULT_METADATA_REQUEST_TIMEOUT);
try
{
this.requestTimeoutMs = new DurationSpec.IntMillisecondsBound(metadataRequestTimeout).toMilliseconds();
}
catch (IllegalArgumentException ex)
{
throw new ConfigurationException(format("%s as value of %s is invalid duration! " + ex.getMessage(),
metadataRequestTimeout,
METADATA_REQUEST_TIMEOUT_PROPERTY));
}
}
public SnitchProperties getProperties()
{
return properties;
}
public final String apiCall(String query) throws IOException
{
return apiCall(metadataServiceUrl, query, "GET", ImmutableMap.of(), 200);
}
public final String apiCall(String query, Map<String, String> extraHeaders) throws IOException
{
return apiCall(metadataServiceUrl, query, "GET", extraHeaders, 200);View on GitHub (pinned to 88fd0f6a0e)
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
Example fix
// before cassandra-env.sh: JVM_OPTS="$JVM_OPTS -Dcassandra.metadata_request_timeout=10sec" // after cassandra-env.sh: JVM_OPTS="$JVM_OPTS -Dcassandra.metadata_request_timeout=10s"
Defensive patterns
Strategy: validation
Validate before calling
// Validate before setting the JVM property / yaml value
String v = System.getProperty("cassandra.metadata_request_timeout", "");
if (!v.isEmpty()) {
try {
new DurationSpec.IntMillisecondsBound(v);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Bad " + "cassandra.metadata_request_timeout" + " value: " + v);
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.
Related errors
- Configuration must specify either node_proximity and initial
- Snitch metadata service URL '%s' is invalid. Please review s
- No metadata server could be found in lease file.
- Initial location provider rejected registration location, pl
- %s has authorization enabled which requires %s to enable aut
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/c65eeedd8aa5b71c.
Report an issue: GitHub.