{"record":{"id":"54c357eb0e684482","repo":"apache/cassandra","slug":"d-must-be-greater-than-1-for-s","errorCode":null,"errorMessage":"%d must be greater than 1 for %s","messagePattern":"(.+?) must be greater than 1 for (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyOptions.java","lineNumber":128,"sourceCode":"        try\n        {\n            if (optionValue != null)\n                if (!validWindowTimeUnits.contains(TimeUnit.valueOf(optionValue)))\n                    throw new ConfigurationException(String.format(\"%s is not valid for %s\", optionValue, COMPACTION_WINDOW_UNIT_KEY));\n\n        }\n        catch (IllegalArgumentException e)\n        {\n            throw new ConfigurationException(String.format(\"%s is not valid for %s\", optionValue, COMPACTION_WINDOW_UNIT_KEY), e);\n        }\n\n        optionValue = options.get(COMPACTION_WINDOW_SIZE_KEY);\n        try\n        {\n            int sstableWindowSize = optionValue == null ? DEFAULT_COMPACTION_WINDOW_SIZE : Integer.parseInt(optionValue);\n            if (sstableWindowSize < 1)\n            {\n                throw new ConfigurationException(String.format(\"%d must be greater than 1 for %s\", sstableWindowSize, COMPACTION_WINDOW_SIZE_KEY));\n            }\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\", optionValue, COMPACTION_WINDOW_SIZE_KEY), e);\n        }\n\n        optionValue = options.get(EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY);\n        try\n        {\n            long expiredCheckFrequency = optionValue == null ? DEFAULT_EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS : Long.parseLong(optionValue);\n            if (expiredCheckFrequency < 0)\n            {\n                throw new ConfigurationException(String.format(\"%s must not be negative, but was %d\", EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY, expiredCheckFrequency));\n             }\n        }\n        catch (NumberFormatException e)\n        {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyOptions.java#L110-L146","documentation":"ConfigurationException thrown when the compaction_window_size option parses as an integer but is less than 1. The window size together with compaction_window_unit defines the duration of each time window, so a value of 0 or negative produces no valid windows and is rejected. Note the message text says 'greater than 1' while the check is actually < 1, so the minimum accepted value is 1.","triggerScenarios":"CREATE/ALTER TABLE with {'class':'TimeWindowCompactionStrategy','compaction_window_size':'0'} or any negative integer, e.g. '-1'.","commonSituations":"Template-driven schema generation where a computed window count evaluates to 0; copy-paste errors dropping a digit; users trying to 'disable' windows by setting size 0.","solutions":["Set compaction_window_size to a positive integer (e.g. '1' with unit DAYS for daily windows).","Remove the option to use the default (1 day).","Fix upstream computation so it clamps window size to >= 1."],"exampleFix":"// before\n{'compaction_window_size':'0','compaction_window_unit':'DAYS'}\n// after\n{'compaction_window_size':'1','compaction_window_unit':'DAYS'}","handlingStrategy":"validation","validationCode":"int windowSize = Integer.parseInt(opts.getOrDefault(\"compaction_window_size\", \"1\"));\nif (windowSize < 1) throw new IllegalArgumentException(\"compaction_window_size must be >= 1\");","typeGuard":null,"tryCatchPattern":"try { schema.alterTable(cql); } catch (ConfigurationException e) { if (e.getMessage().contains(\"greater than 1\")) { /* set a positive window size and retry */ } else throw e; }","preventionTips":["Clamp computed window sizes to Math.max(1, size) in templates.","Use the default (1) with DAYS/HOURS to tune duration instead of 0.","Never set window size to 0 or negative to 'disable' windows — remove TWCS instead."],"tags":["compaction","twcs","configuration"],"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"}