{"record":{"id":"d6a83d9fe744d9da","repo":"apache/cassandra","slug":"invalid-verb-id-id-we-only-allow-ids-between","errorCode":null,"errorMessage":"Invalid verb id + id + - we only allow ids between 0 and CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID","messagePattern":"Invalid verb id \\+ id \\+ - we only allow ids between 0 and CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID","errorType":"panic","errorClass":"AssertionError","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/net/Verb.java","lineNumber":495,"sourceCode":"        this(kind, id, priority, expiration, stage, serializer, handler, null);\n    }\n\n    Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb)\n    {\n        this.stage = stage;\n        if (id < 0)\n            throw new IllegalArgumentException(\"Verb id must be non-negative, got \" + id + \" for verb \" + name());\n\n        if (kind == CUSTOM)\n        {\n            if (id > MAX_CUSTOM_VERB_ID)\n                throw new AssertionError(\"Invalid custom verb id \" + id + \" - we only allow custom ids between 0 and \" + MAX_CUSTOM_VERB_ID);\n            this.id = idForCustomVerb(id);\n        }\n        else\n        {\n            if (id > CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID)\n                throw new AssertionError(\"Invalid verb id \" + id + \" - we only allow ids between 0 and \" + (CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID));\n            this.id = id;\n        }\n        this.priority = priority;\n        this.serializer = serializer;\n        this.handler = handler;\n        this.responseVerb = responseVerb;\n        this.expiration = expiration;\n        this.kind = kind;\n        // this is a little hacky, but reduces the number of parameters up top\n        this.isResponse = name().endsWith(\"_RSP\") || handler == RESPONSE_HANDLER;\n    }\n\n    public <In, Out> IVersionedAsymmetricSerializer<In, Out> serializer()\n    {\n        return (IVersionedAsymmetricSerializer<In, Out>) serializer.get();\n    }\n\n    public <T> IVerbHandler<T> handler()","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/Verb.java#L477-L513","documentation":"For non-CUSTOM (built-in) verbs, the id must be in [0, CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID] so built-in and custom id spaces never overlap. A too-large built-in id fails with AssertionError in the Verb constructor.","triggerScenarios":"Declaring a built-in Verb with id > CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID, e.g. appending a new built-in verb with an id chosen carelessly at the end of the enum.","commonSituations":"Adding new built-in verbs in the Verb enum and using the next raw integer without checking the reserved custom range; merge conflicts that duplicate or bump ids.","solutions":["Assign the new built-in verb an id <= CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID, keeping custom ids >= CUSTOM_VERB_START separate","Review the Verb enum id allocation scheme before adding verbs","Add a startup/test check that all ids are within bounds and non-overlapping"],"exampleFix":"// before\nNEW_VERB(MESSAGES, CUSTOM_VERB_START - 1, ...)\n// after\nNEW_VERB(MESSAGES, CUSTOM_VERB_START - MAX_CUSTOM_VERB_ID - 1, ...) // inside built-in range","handlingStrategy":"validation","validationCode":"if (kind != Verb.Kind.CUSTOM && id > Verb.CUSTOM_VERB_START - Verb.MAX_CUSTOM_VERB_ID) throw new IllegalArgumentException(\"built-in verb id out of range: \" + id);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a registry of allocated built-in ids and the maximum allowed value","Assign new built-in verbs sequentially from the end of the allowed range","Add a static check that built-in and custom id spaces do not overlap"],"tags":["network","enum","verb-id","id-range"],"backgroundTag":"value-out-of-range","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"}