{"record":{"id":"1952e016115526c9","repo":"apache/cassandra","slug":"error-starting-native-transport","errorCode":null,"errorMessage":"Error starting native transport: ","messagePattern":"Error starting native transport: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":610,"sourceCode":"        return Gossiper.instance.isEnabled();\n    }\n\n    public synchronized void startNativeTransport()\n    {\n        checkServiceAllowedToStart(\"native transport\");\n\n        if (daemon == null)\n        {\n            throw new IllegalStateException(\"No configured daemon\");\n        }\n\n        try\n        {\n            daemon.startNativeTransport();\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Error starting native transport: \" + e.getMessage());\n        }\n    }\n\n    public void stopNativeTransport(boolean force)\n    {\n        if (daemon == null)\n        {\n            throw new IllegalStateException(\"No configured daemon\");\n        }\n        daemon.stopNativeTransport(force);\n    }\n\n    public boolean isNativeTransportRunning()\n    {\n        if (daemon == null)\n        {\n            return false;\n        }","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L592-L628","documentation":"RuntimeException wrapping the message of any exception thrown by daemon.startNativeTransport(). It deliberately loses the original stack trace, surfacing only e.getMessage(), so the real cause (port bind failure, missing config, internal CQL server error) is hidden.","triggerScenarios":"Any exception inside CassandraDaemon.startNativeTransport() while enabling the CQL native protocol server — most commonly native_transport_port already bound, or an initialization error in the transport layer.","commonSituations":"Port 9042 already in use by another process or a second Cassandra instance; firewall/privilege issues on low ports; corrupted config causing transport init failure; enabling native transport via nodetool enablethrift-era scripts that surfaced only the wrapped message.","solutions":["Check the server log (system.log) for the original stack trace — the RuntimeException hides it.","Free the native transport port: `ss -ltnp | grep 9042`, stop the conflicting process or change native_transport_port in cassandra.yaml.","Fix the underlying daemon exception reported in the log, then `nodetool enablenativetransport` again.","If instrumenting, preserve the cause: throw new RuntimeException(msg, e) instead of dropping the stack trace."],"exampleFix":"// before (in StorageService)\nthrow new RuntimeException(\"Error starting native transport: \" + e.getMessage());\n// after\nthrow new RuntimeException(\"Error starting native transport: \" + e.getMessage(), e);","handlingStrategy":"try-catch","validationCode":"try (Socket probe = new Socket()) {\n    probe.connect(new InetSocketAddress(\"127.0.0.1\", nativeTransportPort), 500);\n    warn(\"native transport port already in use\");\n} catch (IOException expectedFree) { /* port free, safe to start */ }","typeGuard":null,"tryCatchPattern":"catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Error starting native transport\")) {\n        // cause is hidden; read system.log for the original stack trace\n        investigateServerLog();\n        return;\n    }\n    throw e;\n}","preventionTips":["Reserve/verify port 9042 (or configured native_transport_port) is free before startup.","Always correlate this wrapper message with the server log — it hides the stack trace.","Wrap causes when rethrowing: new RuntimeException(msg, e).","Alert on native transport startup failures during rolling restarts."],"tags":["cassandra","native-transport","runtime-exception","port-binding","startup"],"backgroundTag":"http-request-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}