{"record":{"id":"6bfb8c9530b0633f","repo":"apache/cassandra","slug":"invalid-custom-verb-id-id-we-only-allow-cust","errorCode":null,"errorMessage":"Invalid custom verb id + id + - we only allow custom ids between 0 and MAX_CUSTOM_VERB_ID","messagePattern":"Invalid custom verb id \\+ id \\+ - we only allow custom ids between 0 and MAX_CUSTOM_VERB_ID","errorType":"panic","errorClass":"AssertionError","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/net/Verb.java","lineNumber":489,"sourceCode":"    {\n        this(NORMAL, id, priority, expiration, stage, serializer, handler, responseVerb);\n    }\n\n    Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler)\n    {\n        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","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/Verb.java#L471-L507","documentation":"For CUSTOM-kind verbs, ids must fall in [0, MAX_CUSTOM_VERB_ID] so they fit in the custom id space after idForCustomVerb() offsetting. Exceeding that bound is treated as a developer error and fails with AssertionError in the Verb constructor.","triggerScenarios":"Declaring Verb(CUSTOM, id, ...) with id > MAX_CUSTOM_VERB_ID, e.g. picking a raw wire id equal to a built-in verb's id instead of a small custom index.","commonSituations":"Adding custom verbs (e.g. for messaging-coordinator or test extensions) and choosing an id from the built-in range instead of the custom range.","solutions":["Use a custom id between 0 and MAX_CUSTOM_VERB_ID; idForCustomVerb() computes the wire id","Reuse an existing unused custom id slot instead of inventing a large one","Check Verb.MAX_CUSTOM_VERB_ID/CUSTOM_VERB_START constants when adding verbs"],"exampleFix":"// before\nMY_VERB(CUSTOM, CUSTOM_VERB_START, ...)\n// after\nMY_VERB(CUSTOM, 1, ...) // small custom index; wire id derived via idForCustomVerb","handlingStrategy":"validation","validationCode":"if (kind == Verb.Kind.CUSTOM && !(id >= 0 && id <= Verb.MAX_CUSTOM_VERB_ID)) throw new IllegalArgumentException(\"custom verb id out of range: \" + id);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick custom verb ids as small sequential indices in [0, MAX_CUSTOM_VERB_ID]","Never use built-in wire ids for custom verbs","Consult CUSTOM_VERB_START/MAX_CUSTOM_VERB_ID constants when registering verbs"],"tags":["network","enum","verb-id","custom-verb"],"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"}