apache/cassandra · error · ConfigurationException

Unable to set value to parameter

Error message

Unable to set value to parameter %s: %s. Reason: %s

What it means

Thrown when a compression dictionary training size parameter cannot be parsed into a valid DataStorageSpec.IntBytesBound. Cassandra validates training config values (e.g. max dictionary size, max total sample size) as byte-size strings, and any parse or conversion failure inside validateSizeBasedTrainingParameter is wrapped into this ConfigurationException with the parameter name, raw value, and underlying reason.

Solutions

  1. Fix the value to a valid byte-size string such as '64KiB', '1MiB', or '1073741824'
  2. Check the Reason: suffix in the message for the exact parse failure
  3. Use DataStorageSpec.IntBytesBound.parse in client code to pre-validate before setting
  4. Consult cassandra.yaml / CQL docs for accepted units (B, KiB, MiB, GiB, TiB)

Example fix

// before
ALTER TABLE t WITH compression = { 'class': 'LZ4Compressor', 'max_dictionary_size': '10 mbs' };
// after
ALTER TABLE t WITH compression = { 'class': 'LZ4Compressor', 'max_dictionary_size': '10MiB' };
Defensive patterns

Strategy: validation

Validate before calling

try { new DataStorageSpec.IntBytesBound(value); } catch (Exception e) { throw new IllegalArgumentException("Bad size: " + value); }

Type guard

boolean isValidByteSize(String v) { try { new DataStorageSpec.IntBytesBound(v); return true; } catch (Exception e) { return false; } }

Try / catch

try { cfg.setMaxDictionarySize(v); } catch (ConfigurationException e) { log.error("Bad training size for {}: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling getMaxDictionarySize or getMaxTotalSampleSize (directly or via a SET on table compression training options) with a value that is not a valid byte-size string, has an unknown unit suffix, or overflows IntBytesBound.

Common situations: Typo in unit (e.g. '10 MBs', '1gib' vs '1GiB'), passing a bare number with an unsupported suffix, negative or out-of-int-range sizes, or feeding values programmatically from unvalidated config.

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/a4bb0c7100d32c3e. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/db/compression/CompressionDictionaryTrainingConfig.java:179

    /**
     * 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();
        }
        catch (Throwable t)
        {
            throw new ConfigurationException(format("Unable to set value to parameter %s: %s. Reason: %s",
                                                    parameterName, resolvedValue, t.getMessage()));
        }
    }

    /**
     * Validates value of a parameter for training purposes. The value to validate should
     * be accepted by {@link DurationSpec.IntMinutesBound}. This method is used upon validation of input parameters
     * in the implementation of dictionary compressor.
     *
     * @param parameterName name of a parameter to validate
     * @param resolvedValue value to validate
     * @return resolved value in minutes
     */
    static int validateDurationBasedTrainingParameter(String parameterName, String resolvedValue)
    {
        try
        {
            return new DurationSpec.IntMinutesBound(resolvedValue).toMinutes();

View on GitHub (pinned to 88fd0f6a0e)