apache/seatunnel · error · HiveConnectorException

GET_HIVE_TABLE_INFORMATION_FAILED

GET_HIVE_TABLE_INFORMATION_FAILED

Error message

Failed to get table ${dbName}.${tableName}

What it means

HiveConnectorException (code GET_HIVE_TABLE_INFORMATION_FAILED) thrown by HiveMetaStoreCatalog.getTable when the metastore Thrift call getTable(dbName, tableName) fails with a TException. It wraps the underlying client error (connection problem, metastore outage, or an actual missing table surfaced as TException) with the db and table context.

Source

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

    }

    private static String getFirstMetastoreUri(@NonNull String metastoreUri) {
        String[] uris = metastoreUri.split(",");
        for (String uri : uris) {
            String trimmed = uri.trim();
            if (!trimmed.isEmpty()) {
                return trimmed;
            }
        }
        return "";
    }

    public Table getTable(@NonNull String dbName, @NonNull String tableName) {
        try {
            return getClient().getTable(dbName, tableName);
        } catch (TException e) {
            String msg = String.format("Failed to get table %s.%s", dbName, tableName);
            throw new HiveConnectorException(
                    HiveConnectorErrorCode.GET_HIVE_TABLE_INFORMATION_FAILED, msg, e);
        }
    }

    public void createDatabaseIfNotExists(String db) throws TException {
        try {
            try {
                getClient().getDatabase(db);
                log.debug("Database {} already exists", db);
                return;
            } catch (org.apache.hadoop.hive.metastore.api.NoSuchObjectException ignored) {
            }
            Database database = new Database();
            database.setName(db);
            log.info("Creating database {}", db);
            getClient().createDatabase(database);
        } catch (org.apache.hadoop.hive.metastore.api.AlreadyExistsException e) {
            log.debug("Database {} already exists (race)", db);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Confirm the database and table names exist: run 'SHOW TABLES' / 'DESCRIBE' in Hive or check via beeline.
  2. Verify hive metastore uris in the config point to a reachable metastore (test with telnet/nc on the thrift port, default 9083).
  3. Inspect the chained TException cause for NoSuchObjectException vs connection/timeout errors and fix accordingly.
  4. Check Kerberos/keytab or metastore authentication settings if the cause indicates SASL/authentication failure.

Example fix

// before: reading a table that does not exist
// table = catalog.getTable("default", "user_events")

// after: guard with tableExists first
if (catalog.tableExists("default", "user_events")) {
    Table table = catalog.getTable("default", "user_events");
} else {
    throw new IllegalArgumentException("Table default.user_events does not exist");
}
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.tableExists(dbName, tableName)) {
    throw new IllegalArgumentException(dbName + "." + tableName + " does not exist");
}

Try / catch

try {
    Table t = catalog.getTable(dbName, tableName);
} catch (HiveConnectorException e) {
    // inspect e.getCause(): NoSuchObjectException => missing table; connection errors => metastore issue
    log.error("Metastore getTable failed for {}.{}: {}", dbName, tableName, e.getCause());
}

Prevention

When it happens

Trigger: Calling getTable (or its caller hiveTable) with a database/table that does not exist (NoSuchObjectException), an unreachable metastore URI, thrift timeout, or authentication failure against the Hive metastore.

Common situations: Typo in table name or database name in the job config; metastore service down or moved; Kerberos/SASL misconfiguration; network partition between SeaTunnel worker and metastore.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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