{"record":{"id":"a023345ebc9678b5","repo":"apache/cassandra","slug":"s-is-not-a-valid-size-in-bytes-for-s","errorCode":null,"errorMessage":"%s is not a valid size in bytes for %s","messagePattern":"(.+?) is not a valid size in bytes for (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/unified/Controller.java","lineNumber":640,"sourceCode":"        if (s != null)\n        {\n            try\n            {\n                long sizeInBytes = FBUtilities.parseHumanReadableBytes(s);\n                // zero is a valid option to disable feature\n                if (sizeInBytes < 0)\n                    throw new ConfigurationException(String.format(\"Invalid configuration, %s should be greater than or equal to 0 (zero)\",\n                                                                   MIN_SSTABLE_SIZE_OPTION));\n                long limit = (long) Math.ceil(targetSSTableSize * INVERSE_SQRT_2);\n                if (sizeInBytes >= limit)\n                    throw new ConfigurationException(String.format(\"Invalid configuration, %s (%s) should be less than 70%% of the targetSSTableSize (%s)\",\n                                                                   MIN_SSTABLE_SIZE_OPTION,\n                                                                   FBUtilities.prettyPrintMemory(sizeInBytes),\n                                                                   FBUtilities.prettyPrintMemory(targetSSTableSize)));\n            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a valid size in bytes for %s\",\n                                                               s,\n                                                               MIN_SSTABLE_SIZE_OPTION),\n                                                 e);\n            }\n        }\n\n        s = options.remove(SSTABLE_GROWTH_OPTION);\n        if (s != null)\n        {\n            try\n            {\n                double targetSSTableGrowth  = FBUtilities.parsePercent(s);\n                if (targetSSTableGrowth < 0 || targetSSTableGrowth > 1)\n                {\n                    throw new ConfigurationException(String.format(\"%s %s must be between 0 and 1\",\n                                                                   SSTABLE_GROWTH_OPTION,\n                                                                   s));\n                }","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/unified/Controller.java#L622-L658","documentation":"Cassandra's unified compaction controller validates compaction options at configuration time. The 'min_sstable_size' option must be a byte size parseable by FBUtilities (e.g. '100MiB', '52428800'). When the string cannot be parsed as a number of bytes, a ConfigurationException wrapping the NumberFormatException is thrown so the user learns which option and which value failed.","triggerScenarios":"Calling validateOptions (directly or via setting the compaction strategy options on a table, e.g. ALTER TABLE ... WITH compaction = {'class':'UnifiedCompactionStrategy','min_sstable_size':'abc'}) with a min_sstable_size value that is not a valid byte-size string.","commonSituations":"Typo in the size string ('100 MB' with bad unit, '100mib' misspelling, locale-specific decimal separators, plain garbage values), copy-pasted configs from other systems, or automations writing malformed YAML/option maps.","solutions":["Fix the min_sstable_size option to a valid size string like '50MiB' or a plain byte count like '52428800'.","Omit the option entirely to use the controller's default value.","Use FBUtilities.prettyPrintMemory-compatible units: B, KiB, MiB, GiB, TiB (binary units), not 'MB' style decimal units.","Check the wrapped NumberFormatException message (the cause) to see exactly what failed to parse."],"exampleFix":"// before\nALTER TABLE ks.tbl WITH compaction = {'class': 'UnifiedCompactionStrategy', 'min_sstable_size': '100 MB'};\n// after\nALTER TABLE ks.tbl WITH compaction = {'class': 'UnifiedCompactionStrategy', 'min_sstable_size': '100MiB'};","handlingStrategy":"validation","validationCode":"String v = options.get(\"min_sstable_size\");\nif (v != null) {\n    try { FBUtilities.parseFileSize(v, false); }\n    catch (Exception e) { throw new IllegalArgumentException(\"min_sstable_size must be a valid size like 50MiB: \" + v); }\n}","typeGuard":null,"tryCatchPattern":"try { strategy.validateOptions(opts); } catch (ConfigurationException e) { logger.error(\"Bad compaction option: {}\", e.getMessage()); }","preventionTips":["Use binary units (KiB/MiB/GiB) or plain byte counts for sizes","Lint compaction option maps before applying them via cqlsh or infrastructure code","Copy known-good option examples from Cassandra docs"],"tags":["cassandra","configuration","compaction"],"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"}