{"record":{"id":"8c69bfebc19181bc","repo":"apache/cassandra","slug":"invalid-value-for-s-s","errorCode":null,"errorMessage":"Invalid value for %s: %s","messagePattern":"Invalid value for (.+?): (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryTrainingConfig.java","lineNumber":158,"sourceCode":"\n    private static int internalTrainingParameterResolution(CompressionParams compressionParams,\n                                                           String userSuppliedValue,\n                                                           String parameterName,\n                                                           String defaultParameterValue)\n    {\n        String resolvedValue = null;\n        try\n        {\n            if (userSuppliedValue == null)\n                resolvedValue = compressionParams.getOtherOptions().getOrDefault(parameterName, defaultParameterValue);\n            else\n                resolvedValue = userSuppliedValue;\n\n            return new DataStorageSpec.IntBytesBound(resolvedValue).toBytes();\n        }\n        catch (Throwable t)\n        {\n            throw new IllegalArgumentException(String.format(\"Invalid value for %s: %s\", parameterName, resolvedValue));\n        }\n    }\n\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        }","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryTrainingConfig.java#L140-L176","documentation":"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>'.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nparams.put(\"max_dictionary_size\", \"100 MB\"); // unparsable / out of bound\n// after\nparams.put(\"max_dictionary_size\", \"100MiB\");\nmanager.train(true, params);","handlingStrategy":"validation","validationCode":"try { new DataStorageSpec.IntBytesBound(value); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(\"bad training param: \" + value, e); }","typeGuard":null,"tryCatchPattern":"try { manager.train(force, params); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Invalid value for\")) { /* fix the parameter string and retry */ } else throw e; }","preventionTips":["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"],"tags":["compression","training","invalid-parameter"],"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-14T16:17:12.679Z"}