{"record":{"id":"5a8340ba3ebfa44b","repo":"apache/cassandra","slug":"local-endpoint-port-d-doesn-t-match-yaml-configur","errorCode":null,"errorMessage":"Local endpoint port %d doesn't match YAML configured port %d or legacy SSL port %d","messagePattern":"Local endpoint port (.+?) doesn't match YAML configured port (.+?) or legacy SSL port (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/net/InboundConnectionSettings.java","lineNumber":163,"sourceCode":"\n    public InboundConnectionSettings withLegacySslStoragePortDefaults()\n    {\n        ServerEncryptionOptions encryption = this.encryption;\n        if (encryption == null)\n            encryption = DatabaseDescriptor.getInternodeMessagingEncyptionOptions();\n        encryption = new ServerEncryptionOptions.Builder(encryption).withInternodeEncryption(ServerEncryptionOptions.InternodeEncryption.all).withOptional(false).build();\n\n        return this.withBindAddress(bindAddress.withPort(DatabaseDescriptor.getSSLStoragePort()))\n                   .withEncryption(encryption)\n                   .withDefaults();\n    }\n\n    // note that connectTo is updated even if specified, in the case of pre40 messaging and using encryption (to update port)\n    public InboundConnectionSettings withDefaults()\n    {\n        // this is for the socket that can be plain, only ssl, or optional plain/ssl\n        if (bindAddress.getPort() != DatabaseDescriptor.getStoragePort() && bindAddress.getPort() != DatabaseDescriptor.getSSLStoragePort())\n            throw new ConfigurationException(format(\"Local endpoint port %d doesn't match YAML configured port %d or legacy SSL port %d\",\n                                                    bindAddress.getPort(), DatabaseDescriptor.getStoragePort(), DatabaseDescriptor.getSSLStoragePort()));\n\n        IInternodeAuthenticator authenticator = this.authenticator;\n        ServerEncryptionOptions encryption = this.encryption;\n        Integer socketReceiveBufferSizeInBytes = this.socketReceiveBufferSizeInBytes;\n        Integer applicationReceiveQueueCapacityInBytes = this.applicationReceiveQueueCapacityInBytes;\n        AcceptVersions acceptMessaging = this.acceptMessaging;\n        AcceptVersions acceptStreaming = this.acceptStreaming;\n        SocketFactory socketFactory = this.socketFactory;\n        Function<InetAddressAndPort, InboundMessageHandlers> handlersFactory = this.handlers;\n\n        if (authenticator == null)\n            authenticator = DatabaseDescriptor.getInternodeAuthenticator();\n\n        if (encryption == null)\n            encryption = DatabaseDescriptor.getInternodeMessagingEncyptionOptions();\n\n        if (socketReceiveBufferSizeInBytes == null)","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/net/InboundConnectionSettings.java#L145-L181","documentation":"InboundConnectionSettings.withDefaults() validates that the port of the configured bind address matches either the YAML storage_port or the legacy ssl_storage_port. If the bind address carries a port that corresponds to neither, a ConfigurationException naming both expected ports is thrown.","triggerScenarios":"Constructing an InboundConnectionSettings with a bind address whose port differs from DatabaseDescriptor.getStoragePort() and getSSLStoragePort() — typically in tests or embedded setups that build messaging settings by hand.","commonSituations":"Test code binding an arbitrary ephemeral port; changing storage_port in cassandra.yaml after settings objects were built; pre-4.0 messaging interop paths that rewrite ports.","solutions":["Use DatabaseDescriptor.getStoragePort() (or getSSLStoragePort()) when constructing the bind InetSocketAddress","Fix cassandra.yaml so storage_port matches the port used in the bind address","In tests, derive the port from DatabaseDescriptor values instead of hardcoding","Rebuild settings objects after changing DatabaseDescriptor configuration"],"exampleFix":"// before\nInboundConnectionSettings s = new InboundConnectionSettings().withBindAddress(new InetSocketAddress(host, 9999));\n// after\nInboundConnectionSettings s = new InboundConnectionSettings().withBindAddress(new InetSocketAddress(host, DatabaseDescriptor.getStoragePort()));","handlingStrategy":"validation","validationCode":"// before building InboundConnectionSettings\nint port = bindAddress.getPort();\nif (port != DatabaseDescriptor.getStoragePort() && port != DatabaseDescriptor.getSSLStoragePort())\n    throw new IllegalArgumentException(\"port \" + port + \" must equal storage_port or ssl_storage_port\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always derive ports from DatabaseDescriptor rather than hardcoding","Keep cassandra.yaml storage_port consistent with any programmatically built settings","In tests, use the same port source as production code paths","Rebuild settings objects after changing DatabaseDescriptor configuration"],"tags":["configuration","internode","port-mismatch"],"backgroundTag":"invalid-config-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"}