apache/cassandra · error · java.lang.IllegalArgumentException

Multiple updates for node

Error message

Multiple updates for node %s (%s )

What it means

AlterTopology.parseArgs rejects applying two different location updates to the same node in one call. If the parsed NodeId already exists in the pending map, IllegalArgumentException 'Multiple updates for node' is thrown (note the stray space before ')' in the message).

Solutions

  1. Deduplicate the change list so each nodeId appears once with the final intended location
  2. If both entries were intended, split into sequential AlterTopology invocations
  3. Normalize node identifiers (use the same canonical form) before building the list

Example fix

// before
nodetool altertopology 'id1=dc1:r1,id1=dc2:r2'
// after
nodetool altertopology 'id1=dc2:r2'   // one entry per node, final desired location
Defensive patterns

Strategy: validation

Validate before calling

// enforce one update per node before calling
Map<String,String> byId = new LinkedHashMap<>();
for (String seg : changes.split(",")) {
    String[] parts = seg.trim().split("=");
    if (byId.putIfAbsent(parts[0].trim(), parts[1].trim()) != null)
        throw new IllegalArgumentException("duplicate node: " + parts[0]);
}

Try / catch

try { parseArgs(args, directory); }
catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Multiple updates for node")) { /* deduplicate and retry */ }
    else throw e;
}

Prevention

When it happens

Trigger: Passing a change string that maps the same node id twice, e.g. 'id1=dc1:r1,id1=dc2:r2'; also triggered when the same node is identified via different alias forms that resolve to one NodeId.

Common situations: Accidentally repeating a node in a bulk topology script; generating the list from a source with duplicate rows; specifying a node by both its id and hostname/IP in one invocation.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tcm/transformations/AlterTopology.java:77

        this.updates = updates;
        this.placementProvider = placementProvider;
    }

    public static Map<NodeId, Location> parseArgs(String args, Directory directory)
    {
        Map<NodeId, Location> asMap = new HashMap<>();
        for (String change : args.split(","))
        {
            String[] parts = change.trim().split("=");
            if (parts.length != 2)
                throw new IllegalArgumentException("Invalid specification: " + change);

            if (parts[0].isEmpty() || parts[1].isEmpty())
                throw new IllegalArgumentException("Invalid specification: " + change);

            NodeId id = getNodeIdFromString(parts[0].trim(), directory);
            if (asMap.containsKey(id))
                throw new IllegalArgumentException("Multiple updates for node " + id + " (" + parts[0].trim() + " )");
            asMap.put(getNodeIdFromString(parts[0].trim(), directory), Location.fromString(parts[1].trim()));
        }
        return asMap;
    }

    private static NodeId getNodeIdFromString(String s, Directory directory)
    {
        // first try to parse the id as a node id, either in UUID or int form
        try
        {
            return NodeId.fromString(s);
        }
        catch (Exception e)
        {
            // fall back to trying the supplied id as an endpoint
            try
            {
                InetAddressAndPort endpoint = InetAddressAndPort.getByName(s);

View on GitHub (pinned to 88fd0f6a0e)