{"record":{"id":"9cb95948a1d1fd6d","repo":"apache/cassandra","slug":"invalid-value-for","errorCode":null,"errorMessage":"Invalid value for ","messagePattern":"Invalid value for ","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CompressionParams.java","lineNumber":373,"sourceCode":"     * @param chLengthKB the length of the chunk to parse\n     * @return the chunk length in bytes\n     * @throws ConfigurationException if the chunk size is too large\n     */\n    private static Integer parseChunkLength(String chLengthKB) throws ConfigurationException\n    {\n        if (chLengthKB == null)\n            return null;\n\n        try\n        {\n            int parsed = Integer.parseInt(chLengthKB);\n            if (parsed > Integer.MAX_VALUE / 1024)\n                throw new ConfigurationException(format(\"Value of %s is too large (%s)\", CHUNK_LENGTH_IN_KB,parsed));\n            return 1024 * parsed;\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(\"Invalid value for \" + CHUNK_LENGTH_IN_KB, e);\n        }\n    }\n\n    /**\n     * Removes the chunk length option from the specified set of option.\n     *\n     * @param options the options\n     * @return the chunk length value\n     */\n    private static int removeChunkLength(Map<String, String> options)\n    {\n        if (options.containsKey(CHUNK_LENGTH_IN_KB))\n        {\n            return parseChunkLength(options.remove(CHUNK_LENGTH_IN_KB));\n        }\n\n        return DEFAULT_CHUNK_LENGTH;\n    }","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CompressionParams.java#L355-L391","documentation":"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.","triggerScenarios":"Calling removeChunkLength/fromMap with a non-numeric chunk_length_in_kb value such as '64kb', '4.5', or an empty string.","commonSituations":"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.","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"],"exampleFix":"// before\n{'class': 'LZ4Compressor', 'chunk_length_in_kb': '64kb'}\n// after\n{'class': 'LZ4Compressor', 'chunk_length_in_kb': '64'}","handlingStrategy":"validation","validationCode":"if (value == null || !value.matches(\"\\\\d+\")) throw new IllegalArgumentException(\"chunk_length_in_kb must be an integer, got: \" + value);","typeGuard":null,"tryCatchPattern":"try { params = CompressionParams.fromMap(opts); } catch (ConfigurationException e) { log.error(\"unparseable chunk_length_in_kb\", e); }","preventionTips":["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"],"tags":["config","compression","parse-error"],"backgroundTag":"invalid-argument-format","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"}