apache/seatunnel · error · CassandraConnectorException

COMMON_ERROR_CODE_DEPRECATED_TABLE_SCHEMA_GET_FAILED

COMMON_ERROR_CODE_DEPRECATED_TABLE_SCHEMA_GET_FAILED

Error message

Cannot get table schema from cassandra

What it means

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.

Solutions

  1. Qualify the table with its keyspace in the config (e.g. mykeyspace.mytable) or set a keyspace for the session.
  2. Verify the table exists with `DESCRIBE TABLES` in cqlsh on the same cluster the config points to.
  3. Check host/port/username/password in the Cassandra config; test connectivity with cqlsh.
  4. Inspect the cause of this exception (getCause) for the driver's specific error like NoNodeAvailableException or UnauthorizedException.

Example fix

// before
plugin_output = "mytable"
// after
plugin_output = "mykeyspace.mytable"
Defensive patterns

Strategy: validation

Validate before calling

// run before the job
cqlsh ${HOST} -e "select * from ${KEYSPACE}.${TABLE} limit 1;"

Try / catch

// unwrap the cause to see the driver error
try {
    read(cfg);
} catch (CassandraConnectorException e) {
    log.error("schema fetch failed: {}", e.getCause(), e);
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/17fe37aadde5a823. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cassandra/src/main/java/org/apache/seatunnel/connectors/seatunnel/cassandra/client/CassandraClient.java:83

                                            .withKeyspace(keyspace)
                                            .withLocalDatacenter(dataCenter);
                                })
                        .collect(Collectors.toList());
        return cqlSessionBuilderList.get(
                ThreadLocalRandom.current().nextInt(cqlSessionBuilderList.size()));
    }

    public static SimpleStatement createSimpleStatement(
            String cql, ConsistencyLevel consistencyLevel) {
        return SimpleStatement.builder(cql).setConsistencyLevel(consistencyLevel).build();
    }

    public static ColumnDefinitions getTableSchema(CqlSession session, String table) {
        try {
            return session.execute(String.format("select * from %s limit 1", table))
                    .getColumnDefinitions();
        } catch (Exception e) {
            throw new CassandraConnectorException(
                    CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED,
                    "Cannot get table schema from cassandra",
                    e);
        }
    }
}

View on GitHub (pinned to cf67b549a7)