{"record":{"id":"9367b9a6b4f62285","repo":"apache/cassandra","slug":"cannot-have-two-custom-verbs-that-map-to-the-same","errorCode":null,"errorMessage":"cannot have two custom verbs that map to the same id: + v + and + customIdMap[relativeId]","messagePattern":"cannot have two custom verbs that map to the same id: \\+ v \\+ and \\+ customIdMap\\[relativeId\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/net/Verb.java","lineNumber":634,"sourceCode":"        if (minCustom <= max)\n            throw new IllegalStateException(\"Overlapping verb ids are not allowed\");\n\n        Verb[] idMap = new Verb[max + 1];\n        int customCount = minCustom < Integer.MAX_VALUE ? CUSTOM_VERB_START - minCustom : 0;\n        Verb[] customIdMap = new Verb[customCount + 1];\n        for (Verb v : verbs)\n        {\n            switch (v.kind)\n            {\n                case NORMAL:\n                    if (idMap[v.id] != null)\n                        throw new IllegalArgumentException(\"cannot have two verbs that map to the same id: \" + v + \" and \" + idMap[v.id]);\n                    idMap[v.id] = v;\n                    break;\n                case CUSTOM:\n                    int relativeId = idForCustomVerb(v.id);\n                    if (customIdMap[relativeId] != null)\n                        throw new IllegalArgumentException(\"cannot have two custom verbs that map to the same id: \" + v + \" and \" + customIdMap[relativeId]);\n                    customIdMap[relativeId] = v;\n                    break;\n                default:\n                    throw new AssertionError(\"Unsupported Verb Kind: \" + v.kind + \" for verb \" + v);\n            }\n        }\n\n        idToVerbMap = idMap;\n        idToCustomVerbMap = customIdMap;\n    }\n\n    public static Verb fromId(int id)\n    {\n        Verb[] verbs = idToVerbMap;\n        if (id >= minCustomId)\n        {\n            id = idForCustomVerb(id);\n            verbs = idToCustomVerbMap;","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/Verb.java#L616-L652","documentation":"Custom verbs are mapped to a dense relative-id table (customIdMap) computed via idForCustomVerb. If two CUSTOM verbs resolve to the same relative id, the lookup table would overwrite one with the other, so initialization throws IllegalArgumentException.","triggerScenarios":"Registering two CUSTOM Verbs with identical ids (or ids that collapse to the same relative id), triggering Verb class static init.","commonSituations":"Multiple vendor/plugin patches each adding custom verbs with the same hardcoded id; copy-pasting a custom verb declaration without bumping the id.","solutions":["Assign a unique id to one of the two colliding custom verbs, above CUSTOM_VERB_START.","If using plugins/extensions, allocate custom verb id ranges per plugin to avoid collisions.","Check idForCustomVerb to understand the relative-id computation if ids look unique but still collide."],"exampleFix":"// before\nCUSTOM_VERB(5001, \"MY_REFRESH\")\nCUSTOM_VERB(5001, \"MY_RELOAD\")\n// after\nCUSTOM_VERB(5001, \"MY_REFRESH\")\nCUSTOM_VERB(5002, \"MY_RELOAD\")","handlingStrategy":"validation","validationCode":"Set<Integer> seen = new HashSet<>();\nfor (Verb v : Verb.values())\n    if (v.kind == Kind.CUSTOM) assertTrue(seen.add(Verb.idForCustomVerb(v.id)), \"dup custom verb \" + v);\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assign disjoint custom-verb id ranges per patch/plugin","Run Verb class-init in a smoke test before cluster rollout","Document allocated custom ids in the fork's README"],"tags":["startup","messaging","duplicate-id"],"backgroundTag":"internal-invariant-violation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}