apache/seatunnel · error · CatalogException

Failed to get table

Error message

Failed to get table: ${tablePath}

What it means

getTable() wraps any HiveConnectorException raised while fetching or converting the Hive table (getTable(db, tbl) or convertHiveTableToCatalogTable) into a CatalogException. The table exists but its metadata could not be retrieved or mapped to a CatalogTable.

Solutions

  1. Look at the wrapped HiveConnectorException cause for the real failure (fetch vs conversion).
  2. Check the Hive table's SerDe/storage format and column types are supported by the connector.
  3. Verify metastore connectivity — the failure may be transient after the existence check.
  4. Repair corrupted table metadata (e.g., MSCK REPAIR TABLE or recreate the table).
Defensive patterns

Strategy: try-catch

Validate before calling

// check supported storage format/types ahead of time
String inputFormat = /* hive tbl property */ ;
// ensure SerDe and column types are supported by the connector

Try / catch

try {
    return catalog.getTable(tablePath);
} catch (CatalogException e) {
    Throwable cause = e.getCause();
    // inspect HiveConnectorException for fetch vs conversion failure
    throw new RuntimeException("Cannot read Hive table metadata: " + tablePath, cause);
}

Prevention

When it happens

Trigger: Calling getTable(tablePath) when the internal getTable() throws HiveConnectorException (metastore fetch failure) or convertHiveTableToCatalogTable fails on malformed/unsupported table metadata (e.g., unsupported SerDe, missing storage descriptor, unsupported data types).

Common situations: Tables with exotic SerDes or storage formats the converter cannot handle; corrupted HMS metadata; metastore RPC failure after the existence check; unsupported Hive column types.

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/379a11dd253c8d64. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java:620

    @Override
    public boolean tableExists(TablePath tablePath) throws CatalogException {
        return tableExists(tablePath.getDatabaseName(), tablePath.getTableName());
    }

    @Override
    public CatalogTable getTable(TablePath tablePath)
            throws CatalogException, TableNotExistException {
        try {
            if (!tableExists(tablePath.getDatabaseName(), tablePath.getTableName())) {
                throw new TableNotExistException("hive", tablePath);
            }
            Table hiveTable = getTable(tablePath.getDatabaseName(), tablePath.getTableName());
            return convertHiveTableToCatalogTable(hiveTable);
        } catch (TableNotExistException e) {
            throw e;
        } catch (HiveConnectorException e) {
            throw new CatalogException("Failed to get table: " + tablePath, e);
        }
    }

    @Override
    public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists)
            throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {
        try {
            if (!databaseExists(tablePath.getDatabaseName())) {
                throw new DatabaseNotExistException("hive", tablePath.getDatabaseName());
            }

            if (tableExists(tablePath.getDatabaseName(), tablePath.getTableName())) {
                if (!ignoreIfExists) {
                    throw new TableAlreadyExistException("hive", tablePath);
                }
                return;
            }

View on GitHub (pinned to cf67b549a7)