apache/cassandra · error · IllegalArgumentException

Replication factor is empty

Error message

Replication factor is empty

What it means

nodetool cms (reconfigure mode) requires at least one replication factor argument (either a single integer or dc:rf pairs). execute() throws IllegalArgumentException when args is empty and neither --resume nor --cancel was requested.

Source

Thrown at src/java/org/apache/cassandra/tools/nodetool/CMSAdmin.java:163

                return;
            }
            if (resume)
            {
                if (!args.isEmpty())
                    throw new IllegalArgumentException("Replication factor should not be set if previous operation is resumed");

                probe.getCMSOperationsProxy().resumeReconfigureCms();
                return;
            }

            if (cancel)
            {
                probe.getCMSOperationsProxy().cancelReconfigureCms();
                return;
            }

            if (args.isEmpty())
                throw new IllegalArgumentException("Replication factor is empty");

            Map<String, Integer> parsedRfs = new HashMap<>(args.size());
            for (String rf : args)
            {
                if (!rf.contains(":"))
                {
                    if (args.size() > 1)
                        throw new IllegalArgumentException("Simple placement can only specify a single replication factor across all data centers");
                    int parsedRf;
                    try
                    {
                        parsedRf = Integer.parseInt(args.get(0));
                    }
                    catch (Throwable t)
                    {
                        throw new IllegalArgumentException(String.format("Can not parse replication factor from %s", args.get(0)));
                    }
                    probe.getCMSOperationsProxy().reconfigureCMS(parsedRf);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Supply a replication factor: nodetool cms 3
  2. Or per-DC: nodetool cms dc1:3,dc2:5
  3. Check shell variables/quotes so the RF argument actually reaches the command

Example fix

// before
nodetool cms
// after
nodetool cms 3
Defensive patterns

Strategy: validation

Validate before calling

if (args.length == 0)
    throw new IllegalArgumentException("Usage: nodetool cms <rf> | nodetool cms dc1:rf1,dc2:rf2");

Prevention

When it happens

Trigger: Running 'nodetool cms' bare, or with only flags that empty out args, without '3' or 'dc1:3,dc2:5' style arguments.

Common situations: Forgetting the RF argument; a shell variable holding the RF resolved to empty; typo such as 'nodetool cms 3' with the '3' consumed by an unrelated flag.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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