{"record":{"id":"824ae8452bd009a1","repo":"apache/cassandra","slug":"invalid-value-for-data-disk-usage-max-disk-size-0","errorCode":null,"errorMessage":"Invalid value for data_disk_usage_max_disk_size: 0 is not allowed; if attempting to disable use an empty value","messagePattern":"Invalid value for data_disk_usage_max_disk_size: 0 is not allowed; if attempting to disable use an empty value","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/GuardrailsOptions.java","lineNumber":1681,"sourceCode":"                      name, invalidProperties, type);\n    }\n\n    private static Set<ConsistencyLevel> validateConsistencyLevels(Set<ConsistencyLevel> consistencyLevels, String name)\n    {\n        if (consistencyLevels == null)\n            throw new IllegalArgumentException(format(\"Invalid value for %s: null is not allowed\", name));\n\n        return consistencyLevels.isEmpty() ? Collections.emptySet() : Sets.immutableEnumSet(consistencyLevels);\n    }\n\n    private static void validateDataDiskUsageMaxDiskSize(DataStorageSpec.LongBytesBound maxDiskSize)\n    {\n        if (maxDiskSize == null)\n            return;\n\n        // Unlike a guardrail threshold, this is the disk size the percentage thresholds are calculated against, so zero is meaningless\n        if (maxDiskSize.toBytes() == 0)\n            throw new IllegalArgumentException(\"Invalid value for data_disk_usage_max_disk_size: 0 is not allowed; \" +\n                                               \"if attempting to disable use an empty value\");\n\n        long diskSize = DiskUsageMonitor.totalDiskSpace();\n\n        if (diskSize < maxDiskSize.toBytes())\n            throw new IllegalArgumentException(format(\"Invalid value for data_disk_usage_max_disk_size: \" +\n                                                      \"%s specified, but only %s are actually available on disk\",\n                                                      maxDiskSize, FileUtils.stringifyFileSize(diskSize)));\n    }\n\n    /**\n     * This method tests not only valid configuration, but also that what we generate with\n     * a generator passes its validator, so we avoid the situation when a configuration would be valid according\n     * to a concrete implementation of a password validator but passwords it would generate would not pass\n     * its validator which is clearly not desired.\n     *\n     * @param config configuration to use for generator and validator\n     */","sourceCodeStart":1663,"sourceCodeEnd":1699,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/GuardrailsOptions.java#L1663-L1699","documentation":"data_disk_usage_max_disk_size is the baseline disk size against which disk-usage percentage guardrails are computed, so 0 bytes is meaningless. validateDataDiskUsageMaxDiskSize throws IllegalArgumentException when the configured size is exactly 0, telling the user to use an empty value to disable it instead.","triggerScenarios":"Setting data_disk_usage_max_disk_size to 0 or an expression evaluating to 0 bytes (e.g. '0B') in cassandra.yaml, or programmatically constructing a DataStorageSpec.LongBytesBound of 0 and calling the validator.","commonSituations":"Operators attempting to 'disable' the guardrail by setting it to zero instead of leaving the value empty/omitted; scripting config generation that writes 0.","solutions":["Leave data_disk_usage_max_disk_size empty (or remove the line) to disable it.","Set a positive size like '1GiB' if you want an explicit baseline.","Re-validate config before startup."],"exampleFix":"// before (cassandra.yaml)\ndata_disk_usage_max_disk_size: 0B\n// after\ndata_disk_usage_max_disk_size:","handlingStrategy":"validation","validationCode":"if (maxDiskSize != null && maxDiskSize.toBytes() == 0)\n    throw new IllegalArgumentException(\"data_disk_usage_max_disk_size must be empty to disable, or > 0\");","typeGuard":null,"tryCatchPattern":"try { options.validate(); } catch (IllegalArgumentException e) { LOG.error(\"disk usage guardrail invalid: {}\", e.getMessage()); }","preventionTips":["To disable the guardrail leave the value empty; never set 0","Validate any generated cassandra.yaml with Config before deploy","Treat 0 as invalid in config templating for size fields"],"tags":["config","guardrails","disk-usage"],"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"}