apache/cassandra · error · IllegalArgumentException
Invalid value for %s: %s
Error message
Invalid value for %s: %s
What it means
When resolving training parameters (max dictionary size, max total sample size), internalTrainingParameterResolution parses the user-supplied value as a DataStorageSpec.IntBytesBound. If parsing or validation of the resolved value fails for any reason, the method wraps it into an IllegalArgumentException with the message 'Invalid value for <parameter>: <value>'.
Source
Thrown at src/java/org/apache/cassandra/db/compression/CompressionDictionaryTrainingConfig.java:158
private static int internalTrainingParameterResolution(CompressionParams compressionParams,
String userSuppliedValue,
String parameterName,
String defaultParameterValue)
{
String resolvedValue = null;
try
{
if (userSuppliedValue == null)
resolvedValue = compressionParams.getOtherOptions().getOrDefault(parameterName, defaultParameterValue);
else
resolvedValue = userSuppliedValue;
return new DataStorageSpec.IntBytesBound(resolvedValue).toBytes();
}
catch (Throwable t)
{
throw new IllegalArgumentException(String.format("Invalid value for %s: %s", parameterName, resolvedValue));
}
}
/**
* Validates value of a parameter for training purposes. The value to validate should
* be accepted by {@link DataStorageSpec.IntKibibytesBound}. This method is used upon validation
* of input parameters in the implementations of dictionary compressor.
*
* @param parameterName name of a parameter to validate
* @param resolvedValue value to validate
* @return resolved value in bytes
*/
static int validateSizeBasedTrainingParameter(String parameterName, String resolvedValue)
{
try
{
return new DataStorageSpec.IntBytesBound(resolvedValue).toBytes();
}View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Pass a valid DataStorageSpec string, e.g. '64MiB' or '1024KiB', within the allowed bound for the parameter.
- Omit the parameter so the configured default is used instead of an invalid override.
- Check the accepted unit and maximum (IntKibibytesBound) documented for the parameter.
- Verify quoting when passing values through nodetool/JMX so unit suffixes are not stripped.
Example fix
// before
params.put("max_dictionary_size", "100 MB"); // unparsable / out of bound
// after
params.put("max_dictionary_size", "100MiB");
manager.train(true, params); Defensive patterns
Strategy: validation
Validate before calling
try { new DataStorageSpec.IntBytesBound(value); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("bad training param: " + value, e); } Try / catch
try { manager.train(force, params); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Invalid value for")) { /* fix the parameter string and retry */ } else throw e; } Prevention
- Use accepted storage-spec strings like '64MiB' for size parameters
- Stay within the parameter's documented maximum bound
- Quote parameter values carefully in shell/nodetool invocations
When it happens
Trigger: Passing a training parameter (e.g. max_dictionary_size, max_total_sample_size) whose value cannot be parsed by DataStorageSpec.IntBytesBound — non-numeric strings, negative values, values exceeding the IntKibibytesBound maximum, wrong units, or empty strings.
Common situations: Passing plain integers where a storage spec string is expected or vice versa ('100MB' vs '100'); exceeding the KiB-bound maximum; typos like '100 Mb'; passing parameters via JMX/nodetool where quoting strips or mangles units; locale-dependent decimal separators.
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
- Table <keyspaceName>.<tableName> does not support dictionary
- No SSTables available for training in table <keyspaceName>.<
- The next training or importing can occur only at least after
- Training already in progress for table <keyspaceName>.<table
- compressed_read_ahead_buffer_size must be at least 256KiB (s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/8c69bfebc19181bc.
Report an issue: GitHub.