apache/cassandra · error · IllegalArgumentException

Invalid value for data_disk_usage_max_disk_size: 0 is not…

Error message

Invalid value for data_disk_usage_max_disk_size: 0 is not allowed; if attempting to disable use an empty value

What it means

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.

Solutions

  1. Leave data_disk_usage_max_disk_size empty (or remove the line) to disable it.
  2. Set a positive size like '1GiB' if you want an explicit baseline.
  3. Re-validate config before startup.

Example fix

// before (cassandra.yaml)
data_disk_usage_max_disk_size: 0B
// after
data_disk_usage_max_disk_size:
Defensive patterns

Strategy: validation

Validate before calling

if (maxDiskSize != null && maxDiskSize.toBytes() == 0)
    throw new IllegalArgumentException("data_disk_usage_max_disk_size must be empty to disable, or > 0");

Try / catch

try { options.validate(); } catch (IllegalArgumentException e) { LOG.error("disk usage guardrail invalid: {}", e.getMessage()); }

Prevention

When it happens

Trigger: 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.

Common situations: Operators attempting to 'disable' the guardrail by setting it to zero instead of leaving the value empty/omitted; scripting config generation that writes 0.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/824ae8452bd009a1. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/config/GuardrailsOptions.java:1681

                      name, invalidProperties, type);
    }

    private static Set<ConsistencyLevel> validateConsistencyLevels(Set<ConsistencyLevel> consistencyLevels, String name)
    {
        if (consistencyLevels == null)
            throw new IllegalArgumentException(format("Invalid value for %s: null is not allowed", name));

        return consistencyLevels.isEmpty() ? Collections.emptySet() : Sets.immutableEnumSet(consistencyLevels);
    }

    private static void validateDataDiskUsageMaxDiskSize(DataStorageSpec.LongBytesBound maxDiskSize)
    {
        if (maxDiskSize == null)
            return;

        // Unlike a guardrail threshold, this is the disk size the percentage thresholds are calculated against, so zero is meaningless
        if (maxDiskSize.toBytes() == 0)
            throw new IllegalArgumentException("Invalid value for data_disk_usage_max_disk_size: 0 is not allowed; " +
                                               "if attempting to disable use an empty value");

        long diskSize = DiskUsageMonitor.totalDiskSpace();

        if (diskSize < maxDiskSize.toBytes())
            throw new IllegalArgumentException(format("Invalid value for data_disk_usage_max_disk_size: " +
                                                      "%s specified, but only %s are actually available on disk",
                                                      maxDiskSize, FileUtils.stringifyFileSize(diskSize)));
    }

    /**
     * This method tests not only valid configuration, but also that what we generate with
     * a generator passes its validator, so we avoid the situation when a configuration would be valid according
     * to a concrete implementation of a password validator but passwords it would generate would not pass
     * its validator which is clearly not desired.
     *
     * @param config configuration to use for generator and validator
     */

View on GitHub (pinned to 88fd0f6a0e)