apache/cassandra · error · ConfigurationException
Invalid value for
Error message
Invalid value for
What it means
Fired in CompressionParams.parseChunkLength: the chunk_length_in_kb value string cannot be parsed as an integer (Integer.parseInt threw), or the context requires a formatted error 'Invalid value for ' + CHUNK_LENGTH_IN_KB. A ConfigurationException is raised for a malformed compression option value in CREATE/ALTER TABLE.
Source
Thrown at src/java/org/apache/cassandra/schema/CompressionParams.java:373
* @param chLengthKB the length of the chunk to parse
* @return the chunk length in bytes
* @throws ConfigurationException if the chunk size is too large
*/
private static Integer parseChunkLength(String chLengthKB) throws ConfigurationException
{
if (chLengthKB == null)
return null;
try
{
int parsed = Integer.parseInt(chLengthKB);
if (parsed > Integer.MAX_VALUE / 1024)
throw new ConfigurationException(format("Value of %s is too large (%s)", CHUNK_LENGTH_IN_KB,parsed));
return 1024 * parsed;
}
catch (NumberFormatException e)
{
throw new ConfigurationException("Invalid value for " + CHUNK_LENGTH_IN_KB, e);
}
}
/**
* Removes the chunk length option from the specified set of option.
*
* @param options the options
* @return the chunk length value
*/
private static int removeChunkLength(Map<String, String> options)
{
if (options.containsKey(CHUNK_LENGTH_IN_KB))
{
return parseChunkLength(options.remove(CHUNK_LENGTH_IN_KB));
}
return DEFAULT_CHUNK_LENGTH;
}View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Provide chunk_length_in_kb as a plain integer string, e.g. '64' (unit is implied, in KB)
- Quote the value correctly in cqlsh so embedded characters are not introduced
- Remove the option to use the default chunk length
Example fix
// before
{'class': 'LZ4Compressor', 'chunk_length_in_kb': '64kb'}
// after
{'class': 'LZ4Compressor', 'chunk_length_in_kb': '64'} Defensive patterns
Strategy: validation
Validate before calling
if (value == null || !value.matches("\\d+")) throw new IllegalArgumentException("chunk_length_in_kb must be an integer, got: " + value); Try / catch
try { params = CompressionParams.fromMap(opts); } catch (ConfigurationException e) { log.error("unparseable chunk_length_in_kb", e); } Prevention
- Always pass plain integer strings without units
- Validate numeric fields with a regex before building compression maps
- Prefer CompressionParams factory methods over hand-built maps
When it happens
Trigger: Calling removeChunkLength/fromMap with a non-numeric chunk_length_in_kb value such as '64kb', '4.5', or an empty string.
Common situations: Typing the unit inside the value ('64kb'), using a decimal, or passing a map where the value is not a plain digit string when defining or altering a table's compression options.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Value of %s is too large (%s)
- The '%s' option must not be empty. To disable compression us
- Invalid negative or null
- chunk_length_in_kb must be a power of 2
- Invalid negative min_compress_ratio
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/9cb95948a1d1fd6d.
Report an issue: GitHub.