{"record":{"id":"17fe37aadde5a823","repo":"apache/seatunnel","slug":"common-error-code-deprecated-table-schema-get-fail","errorCode":"COMMON_ERROR_CODE_DEPRECATED_TABLE_SCHEMA_GET_FAILED","errorMessage":"Cannot get table schema from cassandra","messagePattern":"Cannot get table schema from cassandra","errorType":"error_code","errorClass":"CassandraConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cassandra/src/main/java/org/apache/seatunnel/connectors/seatunnel/cassandra/client/CassandraClient.java","lineNumber":83,"sourceCode":"                                            .withKeyspace(keyspace)\n                                            .withLocalDatacenter(dataCenter);\n                                })\n                        .collect(Collectors.toList());\n        return cqlSessionBuilderList.get(\n                ThreadLocalRandom.current().nextInt(cqlSessionBuilderList.size()));\n    }\n\n    public static SimpleStatement createSimpleStatement(\n            String cql, ConsistencyLevel consistencyLevel) {\n        return SimpleStatement.builder(cql).setConsistencyLevel(consistencyLevel).build();\n    }\n\n    public static ColumnDefinitions getTableSchema(CqlSession session, String table) {\n        try {\n            return session.execute(String.format(\"select * from %s limit 1\", table))\n                    .getColumnDefinitions();\n        } catch (Exception e) {\n            throw new CassandraConnectorException(\n                    CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED,\n                    \"Cannot get table schema from cassandra\",\n                    e);\n        }\n    }\n}\n","sourceCodeStart":65,"sourceCodeEnd":90,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cassandra/src/main/java/org/apache/seatunnel/connectors/seatunnel/cassandra/client/CassandraClient.java#L65-L90","documentation":"CassandraClient.getTableSchema executes `select * from <table> limit 1` to discover the schema via the result set's ColumnDefinitions. Any exception running that query (table missing, auth failure, driver/connection error) is wrapped as this TABLE_SCHEMA_GET_FAILED error. The generic message hides the underlying cause, which is attached as the exception cause.","triggerScenarios":"session.execute(\"select * from <table> limit 1\") throws — invalid/quoted table name, keyspace not set in the session so the table can't be resolved, connection/auth failures, or driver timeouts.","commonSituations":"Config uses table name without keyspace while session has no default keyspace; table doesn't exist in the connected cluster; Cassandra authentication credentials wrong; network/firewall blocking the CQL port (9042).","solutions":["Qualify the table with its keyspace in the config (e.g. mykeyspace.mytable) or set a keyspace for the session.","Verify the table exists with `DESCRIBE TABLES` in cqlsh on the same cluster the config points to.","Check host/port/username/password in the Cassandra config; test connectivity with cqlsh.","Inspect the cause of this exception (getCause) for the driver's specific error like NoNodeAvailableException or UnauthorizedException."],"exampleFix":"// before\nplugin_output = \"mytable\"\n// after\nplugin_output = \"mykeyspace.mytable\"","handlingStrategy":"validation","validationCode":"// run before the job\ncqlsh ${HOST} -e \"select * from ${KEYSPACE}.${TABLE} limit 1;\"","typeGuard":null,"tryCatchPattern":"// unwrap the cause to see the driver error\ntry {\n    read(cfg);\n} catch (CassandraConnectorException e) {\n    log.error(\"schema fetch failed: {}\", e.getCause(), e);\n    throw e;\n}","preventionTips":["Always qualify tables with keyspace in config.","Smoke-test CQL connectivity with cqlsh before submitting jobs.","Pin driver/server compatible versions."],"tags":["cassandra","schema","cql","connection"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}