{"record":{"id":"5cdd138057a18683","repo":"apache/cassandra","slug":"unknown-connection-category-category","errorCode":null,"errorMessage":"Unknown connection category: + category","messagePattern":"Unknown connection category: \\+ category","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/net/OutboundConnectionSettings.java","lineNumber":414,"sourceCode":"    }\n\n    public int tcpConnectTimeoutInMS()\n    {\n        return tcpConnectTimeoutInMS != null ? tcpConnectTimeoutInMS\n                                             : DatabaseDescriptor.getInternodeTcpConnectTimeoutInMS();\n    }\n\n    public int tcpUserTimeoutInMS(ConnectionCategory category)\n    {\n        // Reusing tcpUserTimeoutInMS for both messaging and streaming, since the connection is created for either one of them.\n        if (tcpUserTimeoutInMS != null)\n            return tcpUserTimeoutInMS;\n\n        switch (category)\n        {\n            case MESSAGING: return DatabaseDescriptor.getInternodeTcpUserTimeoutInMS();\n            case STREAMING: return DatabaseDescriptor.getInternodeStreamingTcpUserTimeoutInMS();\n            default: throw new IllegalArgumentException(\"Unknown connection category: \" + category);\n        }\n    }\n\n    public boolean tcpNoDelay()\n    {\n        if (tcpNoDelay != null)\n            return tcpNoDelay;\n\n        if (DatabaseDescriptor.isClientOrToolInitialized() || isInLocalDC(getBroadcastAddressAndPort(), to))\n            return INTRADC_TCP_NODELAY;\n\n        return DatabaseDescriptor.getInterDCTcpNoDelay();\n    }\n\n    public AcceptVersions acceptVersions(ConnectionCategory category)\n    {\n        return acceptVersions != null ? acceptVersions\n                                      : category.isStreaming()","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/OutboundConnectionSettings.java#L396-L432","documentation":"OutboundConnectionSettings.tcpUserTimeoutInMS() maps a ConnectionCategory to its yaml-configured TCP user timeout. If the category is neither MESSAGING nor STREAMING, it throws IllegalArgumentException 'Unknown connection category: <category>'.","triggerScenarios":"withDefaults() (or direct callers) computing the TCP user timeout for a connection whose ConnectionCategory falls through the switch — an unexpected or newly added enum value reached this settings path.","commonSituations":"New ConnectionCategory values (e.g. internal URGENT_MESSAGES) added without updating this switch; custom patches passing unsupported categories into settings builders.","solutions":["Add a case for the missing ConnectionCategory (or fall back to the MESSAGING timeout) in tcpUserTimeoutInMS()","Check which category the failing connection uses and configure its timeout via the correct yaml property","If this fires with stock enum values, treat it as an internal bug and report with the stack trace","Write an exhaustive-switch test iterating ConnectionCategory.values()"],"exampleFix":"// before\ndefault: throw new IllegalArgumentException(\"Unknown connection category: \" + category);\n// after\ncase URGENT_MESSAGES: return DatabaseDescriptor.getInternodeTcpUserTimeoutInMS();\ndefault: throw new IllegalArgumentException(\"Unknown connection category: \" + category);","handlingStrategy":"validation","validationCode":"// before computing timeout for a connection\nif (category != ConnectionCategory.MESSAGING && category != ConnectionCategory.STREAMING)\n    throw new IllegalArgumentException(\"tcpUserTimeout not configurable for \" + category);","typeGuard":null,"tryCatchPattern":"try { int t = settings.tcpUserTimeoutInMS(); } catch (IllegalArgumentException e) { int t = DatabaseDescriptor.getInternodeTcpUserTimeoutInMS(); /* safe default */ }","preventionTips":["When adding ConnectionCategory values, grep for all switch statements over the enum","Write an exhaustive-switch test iterating ConnectionCategory.values()","Only pass user-configurable categories (MESSAGING/STREAMING) into settings builders","Keep enum and config-key mapping tables in one place"],"tags":["internode","configuration","illegal-argument","tcp"],"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"}