{"record":{"id":"7523734de93cd777","repo":"apache/cassandra","slug":"unable-to-initialise-s","errorCode":null,"errorMessage":"Unable to initialise %s","messagePattern":"Unable to initialise (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"tools/sstableloader/src/org/apache/cassandra/utils/NativeSSTableLoaderClient.java","lineNumber":124,"sourceCode":"                                                 tokenFactory.fromString(tokenRange.getEnd().getValue().toString()));\n                for (Host endpoint : endpoints)\n                {\n                    int broadcastPort = endpoint.getBroadcastSocketAddress().getPort();\n                    // use port from broadcast address if set.\n                    int portToUse = broadcastPort != 0 ? broadcastPort : storagePort;\n                    addRangeForEndpoint(range, InetAddressAndPort.getByNameOverrideDefaults(endpoint.getAddress().getHostAddress(), portToUse));\n                }\n            }\n\n            Types types = fetchTypes(keyspace, session);\n\n            tables.putAll(fetchTables(keyspace, session, partitioner, types));\n            // We only need the TableMetadata for the views, so we only load that.\n            tables.putAll(fetchViews(keyspace, session, partitioner, types));\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Unable to initialise \" + NativeSSTableLoaderClient.class.getName(), e);\n        }\n    }\n\n    public TableMetadataRef getTableMetadata(String tableName)\n    {\n        return tables.get(tableName);\n    }\n\n    @Override\n    public void setTableMetadata(TableMetadataRef cfm)\n    {\n        tables.put(cfm.name, cfm);\n    }\n\n    private static Types fetchTypes(String keyspace, Session session)\n    {\n        String query = String.format(\"SELECT * FROM %s.%s WHERE keyspace_name = ?\", SchemaConstants.SCHEMA_KEYSPACE_NAME, SchemaKeyspaceTables.TYPES);\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/sstableloader/src/org/apache/cassandra/utils/NativeSSTableLoaderClient.java#L106-L142","documentation":"NativeSSTableLoaderClient.init() connects to the target cluster via the native protocol, fetches schema metadata (tables and materialized views) for a keyspace, and wraps any failure in this RuntimeException. It signals that the SSTable loader client could not initialize its in-memory schema cache. The original exception is preserved as the cause.","triggerScenarios":"Calling NativeSSTableLoaderClient.init(hosts, port) when the cluster is unreachable, authentication fails, the keyspace does not exist, or schema fetch queries fail (e.g. protocol/serialization mismatch between client and server versions).","commonSituations":"sstableloader run against a cluster that is down or firewalled; wrong credentials for an authenticated cluster; typo in keyspace name; loading SSTables of a newer version than the target node supports.","solutions":["Verify the cluster is reachable at the given hosts/port (cqlsh connection test).","Check username/password and authenticator settings on the cluster.","Confirm the keyspace exists (DESCRIBE KEYSPACES in cqlsh).","Inspect the chained cause exception for the root failure (connection refused, auth error, etc.).","Check driver/protocol version compatibility between the tool and the server."],"exampleFix":"// before\nclient.init(hosts, port, null);\n// after\ntry { client.init(hosts, port, null); }\ncatch (RuntimeException e) { System.err.println(\"Init failed: \" + e.getCause()); throw e; }","handlingStrategy":"try-catch","validationCode":"// verify connectivity first\ntry (com.datastax.driver.core.Cluster c = com.datastax.driver.core.Cluster.builder().addContactPoints(hosts).withPort(port).build()) {\n    boolean ksExists = c.getMetadata().getKeyspace(keyspace) != null;\n    if (!ksExists) throw new IllegalStateException(\"keyspace missing: \" + keyspace);\n}","typeGuard":null,"tryCatchPattern":"try { client.init(hosts, port, authProvider); }\ncatch (RuntimeException e) {\n    // cause holds the real failure: IOException (unreachable), auth, protocol mismatch\n    throw new IllegalStateException(\"Loader init failed: \" + e.getCause(), e);\n}","preventionTips":["Test cqlsh connectivity to hosts:port before loading.","Verify keyspace exists on the target cluster.","Check credentials and authenticator config.","Keep tool and server versions protocol-compatible."],"tags":["initialization","network","sstableloader"],"backgroundTag":"module-init-failed","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"}