apache/cassandra · critical · IllegalArgumentException
cannot have two verbs that map to the same id: + v + and +…
Error message
cannot have two verbs that map to the same id: + v + and + idMap[v.id]
What it means
While building the verb-id lookup table at class-init, each NORMAL verb must map to a unique id. If a verb's id is already occupied by another verb in idMap, the registry would be ambiguous, so IllegalArgumentException is thrown.
Solutions
- Find the two verbs named in the message and give one a fresh unique id.
- Regenerate/renumber verb ids for any locally added MAPPING entries.
- After a merge, compile and run the node once in a test env to exercise Verb class-init before deploy.
Example fix
// before MAPPING(42, .., "PREPARE_MSG") MAPPING(42, .., "COMMIT_MSG") // after MAPPING(42, .., "PREPARE_MSG") MAPPING(43, .., "COMMIT_MSG")
Defensive patterns
Strategy: validation
Validate before calling
// test: assert all NORMAL verb ids unique Set<Integer> ids = new HashSet<>(); for (Verb v : Verb.values()) if (v.kind == Kind.NORMAL) assertTrue(ids.add(v.id));
Prevention
- Never hand-pick verb ids; allocate sequentially from a single owner
- Add a CI test iterating all verbs for id uniqueness
- Resolve Verb.java merge conflicts by renumbering, not by keeping both sides
When it happens
Trigger: Declaring two NORMAL Verbs with the same enum-assigned id (copy-paste of a MAPPING line without changing the id), then loading the Verb class.
Common situations: Merge conflicts in Verb.java that keep duplicate id literals; hand-edited patches adding new message types; rebase across versions where ids were renumbered.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- cannot have two custom verbs that map to the same id: + v +…
- Overlapping verb ids are not allowed
- 3
- accord.journal_directory must not be the same as the…
- accord.working_set_size option was set incorrectly to
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/37d9fe3789d8dcf7.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/net/Verb.java:628
default:
throw new AssertionError("Unsupported Verb Kind: " + v.kind + " for verb " + v);
}
}
minCustomId = minCustom;
if (minCustom <= max)
throw new IllegalStateException("Overlapping verb ids are not allowed");
Verb[] idMap = new Verb[max + 1];
int customCount = minCustom < Integer.MAX_VALUE ? CUSTOM_VERB_START - minCustom : 0;
Verb[] customIdMap = new Verb[customCount + 1];
for (Verb v : verbs)
{
switch (v.kind)
{
case NORMAL:
if (idMap[v.id] != null)
throw new IllegalArgumentException("cannot have two verbs that map to the same id: " + v + " and " + idMap[v.id]);
idMap[v.id] = v;
break;
case CUSTOM:
int relativeId = idForCustomVerb(v.id);
if (customIdMap[relativeId] != null)
throw new IllegalArgumentException("cannot have two custom verbs that map to the same id: " + v + " and " + customIdMap[relativeId]);
customIdMap[relativeId] = v;
break;
default:
throw new AssertionError("Unsupported Verb Kind: " + v.kind + " for verb " + v);
}
}
idToVerbMap = idMap;
idToCustomVerbMap = customIdMap;
}
public static Verb fromId(int id)View on GitHub (pinned to 88fd0f6a0e)