{"record":{"id":"c1c5394ac6d3d89b","repo":"apache/cassandra","slug":"value-of-s-is-too-large-s","errorCode":null,"errorMessage":"Value of %s is too large (%s)","messagePattern":"Value of (.+?) is too large \\((.+?)\\)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CompressionParams.java","lineNumber":368,"sourceCode":"    }\n\n    /**\n     * Parse the chunk length (in KiB) and returns it as bytes.\n     *\n     * @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        {","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CompressionParams.java#L350-L386","documentation":"CompressionParams.parseChunkLength parses the chunk_length_in_kb option and throws ConfigurationException when the value in KB is too large to be multiplied by 1024 without int overflow. Cassandra stores chunk length in bytes as an int, so values above Integer.MAX_VALUE/1024 (2097151 KB) cannot be safely represented.","triggerScenarios":"Calling removeChunkLength/fromMap with chunk_length_in_kb set to an integer > 2097151 KB; the raw string parses as an int but 1024*parsed would overflow.","commonSituations":"Copy-pasting an oversized chunk size from tuning blogs or misreading the option as bytes instead of KB when editing schema compression options via cqlsh or a YAML config.","solutions":["Set chunk_length_in_kb to a value <= 2097151 KB (typically 4, 16, 32, or 64 KB)","Remove the explicit chunk_length_in_kb option to fall back to the default (4KB or 64KB depending on version)","If larger chunks are genuinely needed, reconsider the value; Cassandra does not support chunks beyond the int-overflow limit"],"exampleFix":"// before\nCOMPRESSION = {'class': 'LZ4Compressor', 'chunk_length_in_kb': '2097152'}\n// after\nCOMPRESSION = {'class': 'LZ4Compressor', 'chunk_length_in_kb': '64'}","handlingStrategy":"validation","validationCode":"long kb = Long.parseLong(value); if (kb > Integer.MAX_VALUE / 1024) throw new IllegalArgumentException(\"chunk_length_in_kb too large: \" + value);","typeGuard":null,"tryCatchPattern":"try { params = CompressionParams.fromMap(opts); } catch (ConfigurationException e) { log.error(\"bad compression config\", e); throw e; }","preventionTips":["Cap chunk_length_in_kb at 2097151 KB in any UI or templating code","Use conventional sizes (4-64 KB) instead of maximums","Treat the value as KB, never bytes"],"tags":["config","compression","overflow"],"backgroundTag":"value-out-of-range","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"}