{"record":{"id":"15c03f731b9d2893","repo":"apache/cassandra","slug":"s-s-is-out-of-range-of-long","errorCode":null,"errorMessage":"%s %s is out of range of Long.","messagePattern":"(.+?) (.+?) is out of range of Long\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/unified/Controller.java","lineNumber":523,"sourceCode":"            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\",\n                                                               s,\n                                                               BASE_SHARD_COUNT_OPTION), e);\n            }\n        }\n\n        // preserve the configuration for later use during min_sstable_size.\n        long targetSSTableSize = DEFAULT_TARGET_SSTABLE_SIZE;\n        s = options.remove(TARGET_SSTABLE_SIZE_OPTION);\n        if (s != null)\n        {\n            try\n            {\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()),","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/unified/Controller.java#L505-L541","documentation":"Controller.validateOptions parses target_sstable_size using FBUtilities.parseHumanReadable and requires it to fit in a signed long (bytes). Values of Long.MAX_VALUE bytes or larger throw ConfigurationException reporting the option and raw string; below the minimum threshold triggers a different error.","triggerScenarios":"validateOptions with target_sstable_size set to an enormous human-readable value such as '10000000GiB' or '9223372036854775807B' or larger, so the parsed double >= Long.MAX_VALUE.","commonSituations":"Misplaced decimal point or repeated zeros in size strings; unit confusion (GB vs GiB) producing enormous byte counts; scripting that multiplies sizes without bounds checks.","solutions":["Set target_sstable_size to a realistic size like '100MiB' or '1GiB' (well below 2^63 bytes)","Sanitize size inputs to sane upper bounds in tooling","Remove the option to use the default","Catch ConfigurationException around table option validation"],"exampleFix":"// before\n'target_sstable_size': '10000000000GiB'\n// after\n'target_sstable_size': '1GiB'","handlingStrategy":"validation","validationCode":"if (opts.containsKey(\"target_sstable_size\")) {\n    double bytes = FBUtilities.parseHumanReadable(opts.get(\"target_sstable_size\"), null, \"B\");\n    if (bytes >= Long.MAX_VALUE) throw new IllegalArgumentException(\"target_sstable_size exceeds Long range\");\n    if (bytes < FBUtilities.parseHumanReadable(\"50MiB\", null, \"B\")) throw new IllegalArgumentException(\"target_sstable_size too small\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(alterStmt);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"out of range of Long\")) { /* reduce the size value */ }\n    throw e;\n}","preventionTips":["Use sane human-readable sizes like '100MiB'–'1GiB'","Check for runaway zero-padding or unit multipliers in generated configs","Pre-parse sizes with FBUtilities.parseHumanReadable in tooling before applying"],"tags":["cassandra","configuration","compaction","ucs","out-of-range"],"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"}