{"record":{"id":"1994e179fd8dd0b2","repo":"apache/cassandra","slug":"unsupported-type-type","errorCode":null,"errorMessage":"Unsupported type: + type","messagePattern":"Unsupported type: \\+ type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/net/PingRequest.java","lineNumber":56,"sourceCode":"    static final PingRequest forSmall  = new PingRequest(SMALL_MESSAGES);\n    static final PingRequest forLarge  = new PingRequest(LARGE_MESSAGES);\n\n    final ConnectionType connectionType;\n\n    private PingRequest(ConnectionType connectionType)\n    {\n        this.connectionType = connectionType;\n    }\n\n    @VisibleForTesting\n    public static PingRequest get(ConnectionType type)\n    {\n        switch (type)\n        {\n            case URGENT_MESSAGES: return forUrgent;\n            case  SMALL_MESSAGES: return forSmall;\n            case  LARGE_MESSAGES: return forLarge;\n            default: throw new IllegalArgumentException(\"Unsupported type: \" + type);\n        }\n    }\n\n    static IVersionedSerializer<PingRequest> serializer = new IVersionedSerializer<PingRequest>()\n    {\n        public void serialize(PingRequest t, DataOutputPlus out, int version) throws IOException\n        {\n            out.writeByte(t.connectionType.id);\n        }\n\n        public PingRequest deserialize(DataInputPlus in, int version) throws IOException\n        {\n            return get(ConnectionType.fromId(in.readByte()));\n        }\n\n        public long serializedSize(PingRequest t, int version)\n        {\n            return 1;","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/PingRequest.java#L38-L74","documentation":"In PingRequest.get, the ConnectionType switch has no case for the given type (only URGENT/SMALL/LARGE are valid for pings), so the default branch throws. Note the message uses string concatenation '+ type' rather than formatting — a minor bug producing 'Unsupported type: + type' text. Reached via deserialize of a ping request with a corrupt/unsupported connection type.","triggerScenarios":"Calling PingRequest.get(type) with a category outside URGENT_MESSAGES/SMALL_MESSAGES/LARGE_MESSAGES, e.g. from serializer.deserialize() when a future/new category is sent by a peer running a newer version.","commonSituations":"Rolling upgrades where a newer node sends a ping with a category the older node does not know; accidental addition of a new MessageCategory without updating this switch.","solutions":["Upgrade the receiving node so it recognizes the new MessageCategory","If you added a category, add a case (and pool) for it in PingRequest.get()","Check cluster version alignment before pinging across versions"],"exampleFix":"// before\ncase SMALL_MESSAGES: return forSmall;\ndefault: throw new IllegalArgumentException(\"Unsupported type: \" + type);\n// after\ncase SMALL_MESSAGES: return forSmall;\ncase NEW_CATEGORY: return forNew; // added for the new MessageCategory\ndefault: throw new IllegalArgumentException(\"Unsupported type: \" + type);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { pool = PingRequest.get(category); } catch (IllegalArgumentException e) { log.warn(\"Unsupported ping category {}, dropping\", category, e); /* drop ping */ }","preventionTips":["Align cluster versions before rolling upgrades","Update all switches over MessageCategory when adding a new one","Never hand-craft ping messages with unknown categories"],"tags":["network","enum","deserialization","version-skew"],"backgroundTag":"unsupported-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"}