{"record":{"id":"aeeaf2a4178714cc","repo":"apache/cassandra","slug":"unsupported-connection-type-type","errorCode":null,"errorMessage":"unsupported connection type: + type","messagePattern":"unsupported connection type: \\+ type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/net/OutboundConnections.java","lineNumber":253,"sourceCode":"        if (msg.verb().priority == Verb.Priority.P0 || msg.header.hasFlag(MessageFlag.URGENT))\n            return URGENT_MESSAGES;\n        else\n            return SMALL_MESSAGES;\n    }\n\n    @VisibleForTesting\n    final OutboundConnection connectionFor(ConnectionType type)\n    {\n        switch (type)\n        {\n            case SMALL_MESSAGES:\n                return small;\n            case LARGE_MESSAGES:\n                return large;\n            case URGENT_MESSAGES:\n                return urgent;\n            default:\n                throw new IllegalArgumentException(\"unsupported connection type: \" + type);\n        }\n    }\n\n    public long usingReserveBytes()\n    {\n        return reserveCapacity.using();\n    }\n\n    long expiredCallbacks()\n    {\n        return metrics.expiredCallbacks.getCount();\n    }\n\n    void incrementExpiredCallbackCount()\n    {\n        metrics.expiredCallbacks.mark();\n    }\n","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/OutboundConnections.java#L235-L271","documentation":"OutboundConnections.connectionFor(MessageType) returns the outbound connection (small/large/urgent) matching the message size type. Any type other than SMALL/LARGE/URGENT_MESSAGES hits the default branch and throws IllegalArgumentException 'unsupported connection type: <type>'.","triggerScenarios":"Routing a message whose MessageType is not one of the three size buckets — a null/corrupt type, or a new MessageType added without extending connectionFor.","commonSituations":"Forked/patched Cassandra adding new message types; deserialization producing an unexpected type on version-skewed clusters; internal bugs passing verification/internal types into connection routing.","solutions":["Ensure the message type is one of SMALL_MESSAGES, LARGE_MESSAGES, or URGENT_MESSAGES before routing","If a new MessageType was added, add a case mapping it to an appropriate connection","Verify cluster nodes run compatible versions so message types deserialize identically","Capture the offending type value and compare it against the MessageType enum"],"exampleFix":"// before\nconnectionFor(type); // throws for unhandled type\n// after\nswitch (type) {\n  case SMALL_MESSAGES: return small;\n  case LARGE_MESSAGES: return large;\n  case URGENT_MESSAGES: return urgent;\n  default: throw new IllegalStateException(\"type=\" + type); // or map new types here\n}","handlingStrategy":"validation","validationCode":"// guard before routing\nif (type != MessageType.SMALL_MESSAGES && type != MessageType.LARGE_MESSAGES && type != MessageType.URGENT_MESSAGES)\n    throw new IllegalArgumentException(\"cannot route type \" + type);\nOutboundConnections conn = connections.connectionFor(type);","typeGuard":null,"tryCatchPattern":"try { conn = connections.connectionFor(type); } catch (IllegalArgumentException e) { conn = connections.connectionFor(MessageType.SMALL_MESSAGES); /* conservative fallback */ }","preventionTips":["Route only the three supported size buckets (SMALL/LARGE/URGENT)","When adding MessageType values, update OutboundConnections.connectionFor in the same patch","Validate message types on receipt before dispatch","Verify enum compatibility across cluster versions to avoid version-skew surprises"],"tags":["internode","messaging","illegal-argument","routing"],"backgroundTag":"invalid-enum-value","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"}