apache/cassandra · error · ConfigurationException
Invalid value for system property: expected integer value bu
Error message
Invalid value for system property: expected integer value but got '%s'
What it means
Thrown by the INTEGER_CONVERTER used by CassandraRelevantProperties int getters when the property value cannot be decoded as an integer via Integer.decode. It surfaces as a ConfigurationException identifying the offending value.
Source
Thrown at src/java/org/apache/cassandra/config/CassandraRelevantProperties.java:1111
public interface PropertyConverter<T>
{
T convert(String value);
}
private static final PropertyConverter<String> STRING_CONVERTER = value -> value;
private static final PropertyConverter<Boolean> BOOLEAN_CONVERTER = Boolean::parseBoolean;
private static final PropertyConverter<Integer> INTEGER_CONVERTER = value ->
{
try
{
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 ->View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set the property to a plain integer value (optionally 0x hex / 0 octal per Integer.decode)
- Use a size-aware property/getter (getSizeInBytes) if the value should support MiB/GB suffixes
- Check the value for stray whitespace or quotes in your scripts
- Catch ConfigurationException at startup to fail fast with a clear message
Example fix
// before -Dcassandra.num_tokens=16,2 // after -Dcassandra.num_tokens=16
Defensive patterns
Strategy: validation
Validate before calling
String v = System.getProperty("cassandra.some_int");
if (v != null) {
try { Integer.decode(v.trim()); }
catch (NumberFormatException e) { throw new IllegalArgumentException("Not an int: " + v); }
} Try / catch
try {
int v = CassandraRelevantProperties.SOME_INT.getInt();
} catch (ConfigurationException e) {
int v = 16; // fallback
} Prevention
- Use plain integer literals for int properties
- Use size-aware getters for MiB/GB suffixed values
- Trim and unquote values generated by templating tools
When it happens
Trigger: Setting a system property read as an int to a non-integer string, e.g. -Dcassandra.some_int=1024MiB or 'abc', or a value outside int range.
Common situations: Copy-pasting size-style values into integer properties, quoting errors in cassandra-env.sh leaving stray characters, unit conversions confusion between raw ints and size strings.
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 long value but g
- 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/40842c3538be0c3e.
Report an issue: GitHub.