{"record":{"id":"1582d65610884a00","repo":"apache/cassandra","slug":"set-listen-address-or-listen-interface-not-both","errorCode":null,"errorMessage":"Set listen_address OR listen_interface, not both","messagePattern":"Set listen_address OR listen_interface, not both","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":1507,"sourceCode":"        }\n    }\n\n    public static void applyAddressConfig() throws ConfigurationException\n    {\n        applyAddressConfig(conf);\n    }\n\n    public static void applyAddressConfig(Config config) throws ConfigurationException\n    {\n        listenAddress = null;\n        rpcAddress = null;\n        broadcastAddress = null;\n        broadcastRpcAddress = null;\n\n        /* Local IP, hostname or interface to bind services to */\n        if (config.listen_address != null && config.listen_interface != null)\n        {\n            throw new ConfigurationException(\"Set listen_address OR listen_interface, not both\", false);\n        }\n        else if (config.listen_address != null)\n        {\n            try\n            {\n                listenAddress = InetAddress.getByName(config.listen_address);\n            }\n            catch (UnknownHostException e)\n            {\n                throw new ConfigurationException(\"Unknown listen_address '\" + config.listen_address + '\\'', false);\n            }\n\n            if (listenAddress.isAnyLocalAddress())\n                throw new ConfigurationException(\"listen_address cannot be a wildcard address (\" + config.listen_address + \")!\", false);\n        }\n        else if (config.listen_interface != null)\n        {\n            listenAddress = getNetworkInterfaceAddress(config.listen_interface, \"listen_interface\", config.listen_interface_prefer_ipv6);","sourceCodeStart":1489,"sourceCodeEnd":1525,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1489-L1525","documentation":"DatabaseDescriptor.applyAddressConfig validates the network binding configuration. Cassandra binds its internal server to either listen_address (an IP/hostname) or listen_interface (a NIC name) — never both. When both keys are non-null in cassandra.yaml, the node refuses to start with this ConfigurationException.","triggerScenarios":"cassandra.yaml has non-null values for both listen_address and listen_interface at the same time.","commonSituations":" uncommenting listen_interface while forgetting to comment out the default listen_address: localhost line; templating tools (Chef/Puppet/Ansible) that append both settings; merging cluster configs.","solutions":["Open cassandra.yaml and keep exactly one of listen_address or listen_interface (comment the other out).","Most installations should set listen_address to the node IP and leave listen_interface commented.","Restart Cassandra after the edit."],"exampleFix":"# before (cassandra.yaml)\nlisten_address: 10.0.0.5\nlisten_interface: eth0\n# after\nlisten_address: 10.0.0.5\n# listen_interface: eth0","handlingStrategy":"validation","validationCode":"yaml = YAML.load(File.read('conf/cassandra.yaml'))\nraise 'Set listen_address OR listen_interface, not both' if yaml['listen_address'] && yaml['listen_interface']","typeGuard":null,"tryCatchPattern":"catch (ConfigurationException e) { logger.error(\"cassandra.yaml address conflict: {}\", e.getMessage()); System.exit(2); }","preventionTips":["When enabling listen_interface, always comment out listen_address in the same change","Use config templates with mutually exclusive keys guarded by conditionals","Run a yaml validation script in CI before deploying"],"tags":["configuration","network","startup","cassandra"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}