apache/iceberg · error · RuntimeException

Failed to get table info from metastore

Error message

Failed to get table info from metastore <database>.<tableName>

What it means

HiveTableOperations.doRefresh wraps any TException from the Hive metastore get_table call into a RuntimeException 'Failed to get table info from metastore <db>.<table>' with the original cause attached. It indicates a metastore communication or thrift failure rather than a missing table.

Solutions

  1. Check the wrapped cause (e) and verify Hive metastore connectivity (host, port, hive.metastore.uris).
  2. Confirm the metastore service is healthy and reachable (telnet/nc the metastore URI, check metastore logs).
  3. Verify Thrift/Kerberos configuration and client-metastore version compatibility; retry transient failures.

Example fix

// before
conf.set("hive.metastore.uris", "thrift://old-host:9083");
// after
conf.set("hive.metastore.uris", "thrift://metastore.example.com:9083"); // reachable, matching version
Defensive patterns

Strategy: retry

Validate before calling

// before running: verify metastore reachability
new Socket(metastoreHost, metastorePort).close();

Try / catch

try { table.refresh(); } catch (RuntimeException e) { if (e.getCause() instanceof TException) { /* retry with backoff or alert on metastore health */ } }

Prevention

When it happens

Trigger: Thrift connectivity failures, metastore timeouts, serialization errors, or metastore-side exceptions thrown during the get_table call inside doRefresh.

Common situations: Hive metastore down or restarting; network/security-group issues between the job and the metastore; Kerberos/thrift version mismatches; metastore overload.

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/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/df6953b3b3df4ca4. Report an issue: GitHub.

Appendix: source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:199

      HiveOperationsBase.validateTableIsIceberg(table, fullName);

      metadataLocation = table.getParameters().get(METADATA_LOCATION_PROP);
      /* Table key ID must be retrieved from a catalog service, and not from untrusted storage
      (e.g. metadata json file) that can be tampered with. For example, an attacker can remove
      the table key parameter (along with existing snapshots) in the file, making the writers
      produce unencrypted files. Table key ID is taken directly from HMS catalog */
      tableKeyIdFromHMS = table.getParameters().get(TableProperties.ENCRYPTION_TABLE_KEY);
      dekLengthFromHMS = table.getParameters().get(TableProperties.ENCRYPTION_DEK_LENGTH);
      metadataHashFromHMS = table.getParameters().get(METADATA_HASH_PROP);
    } catch (NoSuchObjectException e) {
      if (currentMetadataLocation() != null) {
        throw new NoSuchTableException("No such table: %s.%s", database, tableName);
      }

    } catch (TException e) {
      String errMsg =
          String.format("Failed to get table info from metastore %s.%s", database, tableName);
      throw new RuntimeException(errMsg, e);

    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException("Interrupted during refresh", e);
    }

    refreshFromMetadataLocation(metadataLocation, metadataRefreshMaxRetries);

    if (tableKeyIdFromHMS != null) {
      checkIntegrityForEncryption(tableKeyIdFromHMS, dekLengthFromHMS, metadataHashFromHMS);

      tableKeyId = tableKeyIdFromHMS;
      encryptionDekLength =
          (dekLengthFromHMS != null)
              ? Integer.parseInt(dekLengthFromHMS)
              : TableProperties.ENCRYPTION_DEK_LENGTH_DEFAULT;

      encryptedKeys =

View on GitHub (pinned to 86d9c8fc54)