apache/cassandra · error · org.apache.cassandra.exceptions.ConfigurationException

max_concurrent_automatic_sstable_upgrades can't be negative

Error message

max_concurrent_automatic_sstable_upgrades can't be negative

What it means

validateMaxConcurrentAutoUpgradeTasksConf rejects a negative max_concurrent_automatic_sstable_upgrades value with ConfigurationException. Zero is allowed (disables auto upgrades) but any negative count is invalid; values above concurrent_compactors are only warned about.

Source

Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:5236

    }

    public static int maxConcurrentAutoUpgradeTasks()
    {
        return conf.max_concurrent_automatic_sstable_upgrades;
    }

    public static void setMaxConcurrentAutoUpgradeTasks(int value)
    {
        if (conf.max_concurrent_automatic_sstable_upgrades != value)
            logger.debug("Changing max_concurrent_automatic_sstable_upgrades to {}", value);
        validateMaxConcurrentAutoUpgradeTasksConf(value);
        conf.max_concurrent_automatic_sstable_upgrades = value;
    }

    private static void validateMaxConcurrentAutoUpgradeTasksConf(int value)
    {
        if (value < 0)
            throw new ConfigurationException("max_concurrent_automatic_sstable_upgrades can't be negative");
        if (value > getConcurrentCompactors())
            logger.warn("max_concurrent_automatic_sstable_upgrades ({}) is larger than concurrent_compactors ({})", value, getConcurrentCompactors());
    }

    public static AuditLogOptions getAuditLoggingOptions()
    {
        return conf.audit_logging_options;
    }

    public static void setAuditLoggingOptions(AuditLogOptions auditLoggingOptions)
    {
        conf.audit_logging_options = new AuditLogOptions.Builder(auditLoggingOptions).build();
    }

    public static Config.CorruptedTombstoneStrategy getCorruptedTombstoneStrategy()
    {
        return conf.corrupted_tombstone_strategy;
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass 0 to disable automatic sstable upgrades instead of a negative number
  2. Fix the negative value in cassandra.yaml
  3. Use Math.max(0, value) before calling the setter

Example fix

// before
DatabaseDescriptor.setMaxConcurrentAutoUpgradeTasks(-1);
// after
DatabaseDescriptor.setMaxConcurrentAutoUpgradeTasks(0); // disable
Defensive patterns

Strategy: validation

Validate before calling

if (value < 0) throw new IllegalArgumentException("max_concurrent_automatic_sstable_upgrades must be >= 0");

Try / catch

try { DatabaseDescriptor.setMaxConcurrentAutoUpgradeTasks(v); } catch (ConfigurationException e) { logger.error("invalid max_concurrent_automatic_sstable_upgrades: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling DatabaseDescriptor.setMaxConcurrentAutoUpgradeTasks or setConcurrentCompactors such that a negative value is passed, e.g. setMaxConcurrentAutoUpgradeTasks(-1) or lowering concurrent_compactors below the current value.

Common situations: Negative values in cassandra.yaml (typo or signed int overflow), or JMX/setter misuse when disabling automatic sstable upgrades.

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/4eb895a2ef922c90. Report an issue: GitHub.