{"record":{"id":"e2937ad6028cb171","repo":"apache/iceberg","slug":"failed-to-check-table-existence-of-basetableiden","errorCode":null,"errorMessage":"Failed to check table existence of ${baseTableIdentifier}","messagePattern":"Failed to check table existence of (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":497,"sourceCode":"    TableIdentifier baseTableIdentifier = identifier;\n    if (!isValidIdentifier(identifier)) {\n      if (!isValidMetadataIdentifier(identifier)) {\n        return false;\n      } else {\n        baseTableIdentifier = TableIdentifier.of(identifier.namespace().levels());\n      }\n    }\n\n    String database = baseTableIdentifier.namespace().level(0);\n    String tableName = baseTableIdentifier.name();\n    try {\n      Table table = clients.run(client -> client.getTable(database, tableName));\n      HiveOperationsBase.validateTableIsIceberg(table, fullTableName(name, baseTableIdentifier));\n      return true;\n    } catch (NoSuchTableException | NoSuchObjectException e) {\n      return false;\n    } catch (TException e) {\n      throw new RuntimeException(\"Failed to check table existence of \" + baseTableIdentifier, e);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\n          \"Interrupted in call to check table existence of \" + baseTableIdentifier, e);\n    }\n  }\n\n  @Override\n  public boolean viewExists(TableIdentifier viewIdentifier) {\n    if (!isValidIdentifier(viewIdentifier)) {\n      return false;\n    }\n\n    String database = viewIdentifier.namespace().level(0);\n    String viewName = viewIdentifier.name();\n    try {\n      Table table = clients.run(client -> client.getTable(database, viewName));\n      HiveOperationsBase.validateTableIsIcebergView(table, fullTableName(name, viewIdentifier));","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L479-L515","documentation":"A RuntimeException wrapping a Thrift TException raised while HiveCatalog.tableExists probes the metastore for a table. Iceberg treats NoSuchTableException/NoSuchObjectException as a normal 'false' answer, but any other Thrift failure (connectivity, server error) is unexpected and wrapped with this message. The original exception is the cause.","triggerScenarios":"Calling tableExists(identifier), or any code path that uses it (renameTableOrView, registerTable), when the metastore call client.getTable(...) fails with a TException other than not-found.","commonSituations":"Metastore downtime during job startup; network partitions; Kerberos/authentication failures surfacing as TTransportException; metastore overload under heavy existence-check traffic.","solutions":["Inspect e.getCause() for the Thrift root cause (transport vs server error).","Verify metastore availability, URIs, and credentials (Kerberos/DelegationToken) then retry.","Cache existence checks in hot paths to reduce metastore load and transient failure exposure."],"exampleFix":"// before\nboolean exists = catalog.tableExists(identifier);\n// after\nboolean exists;\ntry {\n  exists = catalog.tableExists(identifier);\n} catch (RuntimeException e) {\n  throw new RuntimeException(\"Metastore unreachable while checking \" + identifier, e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"// Pre-check metastore reachability\n// e.g. socket connect to metastore host:port before bulk existence checks","typeGuard":null,"tryCatchPattern":"try { boolean ok = catalog.tableExists(id); } catch (RuntimeException e) { /* treat as unknown; inspect e.getCause() (TException) */ }","preventionTips":["Distinguish not-found (returns false) from transport failure (throws)","Cache existence results in hot paths","Verify Kerberos credentials before bulk operations","Retry transient TTransportException with backoff"],"tags":["hive-metastore","table-exists","thrift","connectivity"],"backgroundTag":"database-query-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}