apache/cassandra · error · RuntimeException

timeout must be non-negative

Error message

timeout must be non-negative

What it means

NodeProbe.setTimeout(String type, long value) rejects negative timeout values before dispatching to any JMX setter. Timeouts in Cassandra are millisecond durations and must be >= 0. This is a straightforward argument-range validation failure.

Source

Thrown at src/java/org/apache/cassandra/tools/NodeProbe.java:1747

    }

    public String getGossipInfo(boolean withPort, boolean resolveIp)
    {
        if (resolveIp)
            return withPort ? fdProxy.getAllEndpointStatesWithPortAndResolveIp() : fdProxy.getAllEndpointStatesWithResolveIp();
        else
            return withPort ? fdProxy.getAllEndpointStatesWithPort() : fdProxy.getAllEndpointStates();
    }

    public void stop(String string)
    {
        compactionProxy.stopCompaction(string);
    }

    public void setTimeout(String type, long value)
    {
        if (value < 0)
            throw new RuntimeException("timeout must be non-negative");

        switch (type)
        {
            case "misc":
                ssProxy.setRpcTimeout(value);
                break;
            case "read":
                ssProxy.setReadRpcTimeout(value);
                break;
            case "range":
                ssProxy.setRangeRpcTimeout(value);
                break;
            case "write":
                ssProxy.setWriteRpcTimeout(value);
                break;
            case "counterwrite":
                ssProxy.setCounterWriteRpcTimeout(value);
                break;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass a non-negative millisecond value, e.g. `nodetool settimeout write 20000`
  2. Fix the script variable that produced the negative number
  3. To restore defaults, set the original cassandra.yaml value rather than a negative

Example fix

// before
probe.setTimeout("read", -1);
// after
long timeoutMs = 5000;
probe.setTimeout("read", timeoutMs);
Defensive patterns

Strategy: validation

Validate before calling

if (value < 0) throw new IllegalArgumentException("timeout must be >= 0 ms, got " + value);

Try / catch

try { probe.setTimeout(type, value); } catch (RuntimeException e) { /* surface a friendly message to the CLI user */ }

Prevention

When it happens

Trigger: Calling `nodetool settimeout <type> <negative-number>`, e.g. `nodetool settimeout write -100`, or scripting that computes a negative value (e.g. parsing a config with sign error).

Common situations: Automation scripts passing unparsed or wrongly parsed values; confusion between -1 sentinel semantics (not supported here) and actual disable semantics.

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