{"record":{"id":"a4bb0c7100d32c3e","repo":"apache/cassandra","slug":"unable-to-set-value-to-parameter-s-s-reason","errorCode":null,"errorMessage":"Unable to set value to parameter %s: %s. Reason: %s","messagePattern":"Unable to set value to parameter (.+?): (.+?)\\. Reason: (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryTrainingConfig.java","lineNumber":179,"sourceCode":"\n    /**\n     * Validates value of a parameter for training purposes. The value to validate should\n     * be accepted by {@link DataStorageSpec.IntKibibytesBound}. This method is used upon validation\n     * of input parameters in the implementations of dictionary compressor.\n     *\n     * @param parameterName name of a parameter to validate\n     * @param resolvedValue value to validate\n     * @return resolved value in bytes\n     */\n    static int validateSizeBasedTrainingParameter(String parameterName, String resolvedValue)\n    {\n        try\n        {\n            return new DataStorageSpec.IntBytesBound(resolvedValue).toBytes();\n        }\n        catch (Throwable t)\n        {\n            throw new ConfigurationException(format(\"Unable to set value to parameter %s: %s. Reason: %s\",\n                                                    parameterName, resolvedValue, t.getMessage()));\n        }\n    }\n\n    /**\n     * Validates value of a parameter for training purposes. The value to validate should\n     * be accepted by {@link DurationSpec.IntMinutesBound}. This method is used upon validation of input parameters\n     * in the implementation of dictionary compressor.\n     *\n     * @param parameterName name of a parameter to validate\n     * @param resolvedValue value to validate\n     * @return resolved value in minutes\n     */\n    static int validateDurationBasedTrainingParameter(String parameterName, String resolvedValue)\n    {\n        try\n        {\n            return new DurationSpec.IntMinutesBound(resolvedValue).toMinutes();","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryTrainingConfig.java#L161-L197","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the value to a valid byte-size string such as '64KiB', '1MiB', or '1073741824'","Check the Reason: suffix in the message for the exact parse failure","Use DataStorageSpec.IntBytesBound.parse in client code to pre-validate before setting","Consult cassandra.yaml / CQL docs for accepted units (B, KiB, MiB, GiB, TiB)"],"exampleFix":"// before\nALTER TABLE t WITH compression = { 'class': 'LZ4Compressor', 'max_dictionary_size': '10 mbs' };\n// after\nALTER TABLE t WITH compression = { 'class': 'LZ4Compressor', 'max_dictionary_size': '10MiB' };","handlingStrategy":"validation","validationCode":"try { new DataStorageSpec.IntBytesBound(value); } catch (Exception e) { throw new IllegalArgumentException(\"Bad size: \" + value); }","typeGuard":"boolean isValidByteSize(String v) { try { new DataStorageSpec.IntBytesBound(v); return true; } catch (Exception e) { return false; } }","tryCatchPattern":"try { cfg.setMaxDictionarySize(v); } catch (ConfigurationException e) { log.error(\"Bad training size for {}: {}\", e.getMessage()); }","preventionTips":["Always include a valid unit suffix (B, KiB, MiB, GiB)","Pre-parse sizes with DataStorageSpec before applying config","Avoid hand-concatenated size strings from user input"],"tags":["configuration","cassandra","byte-size"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}