apache/cassandra · error · IllegalArgumentException

Concurrent reads must be non-negative

Error message

Concurrent reads must be non-negative

What it means

IllegalArgumentException from setConcurrentReaders: the setter guard rejects a negative value for concurrent_reads. Unlike most yaml-parsed settings this fires on programmatic/runtime updates (e.g. via tooling) since the plain setter has no parsing step; the value must be 0 or a positive thread count.

Solutions

  1. Pass a non-negative integer (0 allowed; typical values 16-64)
  2. Fix the config key concurrent_reads in cassandra.yaml if it is negative

Example fix

// before
DatabaseDescriptor.setConcurrentReaders(-1);
// after
DatabaseDescriptor.setConcurrentReaders(32);
Defensive patterns

Strategy: validation

Validate before calling

if (concurrentReaders < 0)
    throw new IllegalArgumentException("concurrent_reads must be >= 0, got " + concurrentReaders);

Try / catch

try { DatabaseDescriptor.setConcurrentReaders(v); }
catch (IllegalArgumentException e) { logger.error("Invalid concurrent_reads: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling DatabaseDescriptor.setConcurrentReaders(-1) or lower directly, or via JMX/dynamic config with a negative value.

Common situations: JMX scripts computing a value (e.g. multiplier) producing negative result; config typo '-1' intending 'unlimited'.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

    {
        return conf.phi_convict_threshold;
    }

    public static void setPhiConvictThreshold(double phiConvictThreshold)
    {
        conf.phi_convict_threshold = phiConvictThreshold;
    }

    public static int getConcurrentReaders()
    {
        return conf.concurrent_reads;
    }

    public static void setConcurrentReaders(int concurrent_reads)
    {
        if (concurrent_reads < 0)
        {
            throw new IllegalArgumentException("Concurrent reads must be non-negative");
        }
        conf.concurrent_reads = concurrent_reads;
    }

    public static int getConcurrentWriters()
    {
        return conf.concurrent_writes;
    }

    public static void setConcurrentWriters(int concurrent_writers)
    {
        if (concurrent_writers < 0)
        {
            throw new IllegalArgumentException("Concurrent reads must be non-negative");
        }
        conf.concurrent_writes = concurrent_writers;
    }

View on GitHub (pinned to 88fd0f6a0e)