{"record":{"id":"e1cb77a1e04d446a","repo":"apache/cassandra","slug":"s-must-be-greater-than-0-but-was-f","errorCode":null,"errorMessage":"%s must be greater than 0, but was %f","messagePattern":"(.+?) must be greater than 0, but was (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java","lineNumber":461,"sourceCode":"            long columns = sstable.getEstimatedCellPerPartitionCount().mean() * remainingKeys;\n            double remainingColumnsRatio = ((double) columns) / (sstable.getEstimatedCellPerPartitionCount().count() * sstable.getEstimatedCellPerPartitionCount().mean());\n\n            // return if we still expect to have droppable tombstones in rest of columns\n            return remainingColumnsRatio * droppableRatio > tombstoneThreshold;\n        }\n    }\n\n    public static Map<String, String> validateOptions(Map<String, String> options) throws ConfigurationException\n    {\n        String threshold = options.get(TOMBSTONE_THRESHOLD_OPTION);\n        if (threshold != null)\n        {\n            try\n            {\n                float thresholdValue = Float.parseFloat(threshold);\n                if (thresholdValue < 0)\n                {\n                    throw new ConfigurationException(String.format(\"%s must be greater than 0, but was %f\", TOMBSTONE_THRESHOLD_OPTION, thresholdValue));\n                }\n            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\", threshold, TOMBSTONE_THRESHOLD_OPTION), e);\n            }\n        }\n\n        String interval = options.get(TOMBSTONE_COMPACTION_INTERVAL_OPTION);\n        if (interval != null)\n        {\n            try\n            {\n                long tombstoneCompactionInterval = Long.parseLong(interval);\n                if (tombstoneCompactionInterval < 0)\n                {\n                    throw new ConfigurationException(String.format(\"%s must be greater than 0, but was %d\", TOMBSTONE_COMPACTION_INTERVAL_OPTION, tombstoneCompactionInterval));\n                }","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java#L443-L479","documentation":"AbstractCompactionStrategy.validateOptions checks the tombstone_threshold option: the parsed float must be >= 0. A negative value throws ConfigurationException '%s must be greater than 0, but was %f'. Note the check rejects only negative values (0 passes despite the message wording).","triggerScenarios":"ALTER TABLE ... WITH compaction = {'class': '...', 'tombstone_threshold': '-0.1'} or supplying the option in cassandra.yaml/compaction options with a negative float.","commonSituations":"Sign typo in schema definition; copy-pasted negative values from ratio-style options; scripting that computes a negative threshold; confusion between tombstone_threshold (ratio) and tombstone_compaction_interval (seconds).","solutions":["Set tombstone_threshold to a non-negative float between 0 and 1 (it is a ratio of garbage tombstones), e.g. 0.2.","Re-run the ALTER TABLE / nodetool table compaction option update with the corrected value.","If you meant a time-based trigger, use tombstone_compaction_interval instead.","Validate options programmatically via compaction strategy validateOptions before applying."],"exampleFix":"// before\nALTER TABLE ks.tbl WITH compaction = {'class': 'SizeTieredCompactionStrategy', 'tombstone_threshold': '-0.5'};\n// after\nALTER TABLE ks.tbl WITH compaction = {'class': 'SizeTieredCompactionStrategy', 'tombstone_threshold': '0.2'};","handlingStrategy":"validation","validationCode":"float v = Float.parseFloat(opts.getOrDefault(\"tombstone_threshold\", \"0.2\"));\nif (v < 0 || v > 1)\n    throw new ConfigurationException(\"tombstone_threshold must be a ratio in [0,1]\");","typeGuard":null,"tryCatchPattern":"try {\n    strategy.validateOptions(options);\n} catch (ConfigurationException e) {\n    logger.error(\"Invalid compaction option: {}\", e.getMessage());\n}","preventionTips":["Remember tombstone_threshold is a ratio (0..1), not a time or byte count","Validate compaction options with validateOptions before ALTER TABLE","Use tombstone_compaction_interval for time-based tombstone checks"],"tags":["compaction","configuration","validation","cql"],"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-14T16:17:12.679Z"}