apache/cassandra · error · ConfigurationException
Invalid value for system property: expected long value but g
Error message
Invalid value for system property: expected long value but got '%s'
What it means
Thrown by the LONG_CONVERTER used by CassandraRelevantProperties long getters when the property value cannot be decoded as a long via Long.decode, surfaced as a ConfigurationException with the bad value in the message.
Source
Thrown at src/java/org/apache/cassandra/config/CassandraRelevantProperties.java:1124
{
return Integer.decode(value);
}
catch (NumberFormatException e)
{
throw new ConfigurationException(String.format("Invalid value for system property: " +
"expected integer value but got '%s'", value));
}
};
private static final PropertyConverter<Long> LONG_CONVERTER = value ->
{
try
{
return Long.decode(value);
}
catch (NumberFormatException e)
{
throw new ConfigurationException(String.format("Invalid value for system property: " +
"expected long value but got '%s'", value));
}
};
private static final PropertyConverter<Long> SIZE_IN_BYTES_CONVERTER = value ->
{
try
{
return FBUtilities.parseHumanReadableBytes(value);
}
catch (ConfigurationException e)
{
throw new ConfigurationException(String.format("Invalid value for system property: " +
"expected size in bytes with unit but got '%s'\n%s", value, e));
}
};
private static final PropertyConverter<Double> DOUBLE_CONVERTER = value ->View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set the property to a plain long literal (hex/octal allowed via Long.decode)
- Use getSizeInBytes or duration-aware getters for suffixed values
- Strip whitespace/separators from the value in your config tooling
- Catch ConfigurationException and log the offending property value
Example fix
// before -Dcassandra.gc_warn_threshold_in_ms=1,000 // after -Dcassandra.gc_warn_threshold_in_ms=1000
Defensive patterns
Strategy: validation
Validate before calling
String v = System.getProperty("cassandra.gc_warn_threshold_in_ms");
if (v != null) {
try { Long.decode(v.trim()); }
catch (NumberFormatException e) { throw new IllegalArgumentException("Not a long: " + v); }
} Try / catch
try {
long v = CassandraRelevantProperties.SOME_LONG.getLong();
} catch (ConfigurationException e) {
long v = 1000L;
} Prevention
- Avoid thousands separators and suffixes in long properties
- Use getSizeInBytes/duration getters when units are needed
- Validate generated config values in CI before deployment
When it happens
Trigger: Setting a long-typed system property to a non-numeric or overflowing string, e.g. -Dcassandra.some_long=8E or '1,000,000'.
Common situations: Locale-formatted numbers with separators, time/size suffixes placed on a raw long property, malformed values from templated config management.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid value for system property: expected integer value bu
- Invalid value for system property: expected floating point v
- Bad value for system property -D%s.Please use a value betwee
- Missing property value or default value is not set: ${key}
- Invalid value for system propery '%s': expected one of %s (c
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/b2099ac8f9e5a195.
Report an issue: GitHub.