{"record":{"id":"76835c015a6c4683","repo":"apache/cassandra","slug":"s-s-is-not-a-valid-size-in-bytes-s","errorCode":null,"errorMessage":"%s %s is not a valid size in bytes: %s","messagePattern":"(.+?) (.+?) is not a valid size in bytes: (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/unified/Controller.java","lineNumber":538,"sourceCode":"            {\n                double targetSize = FBUtilities.parseHumanReadable(s, null, \"B\");\n                if (targetSize >= Long.MAX_VALUE) {\n                    throw new ConfigurationException(String.format(\"%s %s is out of range of Long.\",\n                                                                    TARGET_SSTABLE_SIZE_OPTION,\n                                                                    s));\n                }\n                if (targetSize < MIN_TARGET_SSTABLE_SIZE)\n                {\n                    throw new ConfigurationException(String.format(\"%s %s is not acceptable, size must be at least %s\",\n                                                                   TARGET_SSTABLE_SIZE_OPTION,\n                                                                   s,\n                                                                   FBUtilities.prettyPrintMemory(MIN_TARGET_SSTABLE_SIZE)));\n                }\n                targetSSTableSize = (long) Math.ceil(targetSize);\n            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s %s is not a valid size in bytes: %s\",\n                                                               TARGET_SSTABLE_SIZE_OPTION,\n                                                               s,\n                                                               e.getMessage()),\n                                                 e);\n            }\n        }\n\n        s = options.remove(FLUSH_SIZE_OVERRIDE_OPTION);\n        if (s != null)\n        {\n            try\n            {\n                long flushSize = FBUtilities.parseHumanReadableBytes(s);\n                if (flushSize < MIN_TARGET_SSTABLE_SIZE)\n                    throw new ConfigurationException(String.format(\"%s %s is not acceptable, size must be at least %s\",\n                                                                   FLUSH_SIZE_OVERRIDE_OPTION,\n                                                                   s,\n                                                                   FBUtilities.prettyPrintMemory(MIN_TARGET_SSTABLE_SIZE)));","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/unified/Controller.java#L520-L556","documentation":"Thrown when the target_sstable_size string cannot be parsed as a number of bytes by FBUtilities.parseHumanReadableBytes; the NumberFormatException is wrapped into a ConfigurationException. The option must be a human-readable byte size like '160MiB' or a plain long byte count.","triggerScenarios":"Controller.validateOptions receives a target_sstable_size value that parseHumanReadableBytes rejects (non-numeric text, malformed unit suffix, empty string), e.g. via CREATE TABLE compaction options or ALTER TABLE.","commonSituations":"Typos such as '160 MiB' with unexpected characters, '10GBX', locale-formatted numbers ('10,000'), or passing a decimal like '1.5GB' where the parser expects an integer quantity.","solutions":["Provide a valid human-readable size string, e.g. 'target_sstable_size': '160MiB'.","Use a plain integer byte count if unit suffixes are causing problems.","Remove the option to fall back to the default target sstable size."],"exampleFix":"// before\n'target_sstable_size': '160 MB!'\n// after\n'target_sstable_size': '160MiB'","handlingStrategy":"validation","validationCode":"try { FBUtilities.parseHumanReadableBytes(opts.get(\"target_sstable_size\")); } catch (NumberFormatException e) { /* reject before schema change */ }","typeGuard":null,"tryCatchPattern":"try { alterTable(); } catch (ConfigurationException e) { fixAndRetry(e.getMessage()); }","preventionTips":["Use only 'NNN unit' literals understood by FBUtilities.parseHumanReadableBytes (e.g. 160MiB)","Avoid locale-formatted numbers and stray whitespace in config templates","Test generated configs in a scratch keyspace first"],"tags":["cassandra","configuration","compaction","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-17T15:17:12.973Z"}