apache/cassandra · error · ConfigurationException

concurrent_counter_writes must be at least 2, but was ${conf

Error message

concurrent_counter_writes must be at least 2, but was ${conf.concurrent_counter_writes}

What it means

concurrent_counter_writes sizes the counter-write stage thread pool and must be at least 2, mirroring the other concurrent_* pool checks. applySimpleConfig throws this ConfigurationException at startup for smaller values.

Source

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

        /* phi convict threshold for FailureDetector */
        if (conf.phi_convict_threshold < 5 || conf.phi_convict_threshold > 16)
        {
            throw new ConfigurationException("phi_convict_threshold must be between 5 and 16, but was " + conf.phi_convict_threshold, false);
        }

        /* Thread per pool */
        if (conf.concurrent_reads < 2)
        {
            throw new ConfigurationException("concurrent_reads must be at least 2, but was " + conf.concurrent_reads, false);
        }

        if (conf.concurrent_writes < 2 && TEST_FAIL_MV_LOCKS_COUNT.getString("").isEmpty())
        {
            throw new ConfigurationException("concurrent_writes must be at least 2, but was " + conf.concurrent_writes, false);
        }

        if (conf.concurrent_counter_writes < 2)
            throw new ConfigurationException("concurrent_counter_writes must be at least 2, but was " + conf.concurrent_counter_writes, false);

        if (conf.networking_cache_size == null)
            conf.networking_cache_size = new DataStorageSpec.IntMebibytesBound(Math.min(128, (int) (Runtime.getRuntime().maxMemory() / (16 * 1048576))));

        if (conf.file_cache_size == null)
            conf.file_cache_size = new DataStorageSpec.IntMebibytesBound(Math.min(512, (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576))));

        // round down for SSDs and round up for spinning disks
        if (conf.file_cache_round_up == null)
            conf.file_cache_round_up = conf.disk_optimization_strategy == Config.DiskOptimizationStrategy.spinning;

        if (conf.memtable_offheap_space == null)
            conf.memtable_offheap_space = new DataStorageSpec.IntMebibytesBound((int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));
        // for the moment, we default to twice as much on-heap space as off-heap, as heap overhead is very large
        if (conf.memtable_heap_space == null)
            conf.memtable_heap_space = new DataStorageSpec.IntMebibytesBound((int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));
        if (conf.memtable_heap_space.toMebibytes() == 0)
            throw new ConfigurationException("memtable_heap_space must be positive, but was " + conf.memtable_heap_space, false);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set `concurrent_counter_writes` to at least 2 (default is 32).
  2. Remove the override so the default applies.
  3. Update automated tuning scripts to clamp all concurrent_* pools to a minimum of 2.

Example fix

// before (cassandra.yaml)
concurrent_counter_writes: 1
// after (cassandra.yaml)
concurrent_counter_writes: 32
Defensive patterns

Strategy: validation

Validate before calling

// Java, before toolInitialization()
int counterWrites = /* configured concurrent_counter_writes */;
if (counterWrites < 2)
    throw new IllegalArgumentException("concurrent_counter_writes must be >= 2, got " + counterWrites);

Prevention

When it happens

Trigger: Setting `concurrent_counter_writes: 0` or `1` in cassandra.yaml (or programmatic Config) before DatabaseDescriptor.toolInitialization/applyAll.

Common situations: Counter-light deployments where operators minimize the pool; shared generated configs applying the same low value to all concurrent_* settings; typos or arithmetic in automated tuning scripts.

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