{"record":{"id":"10a26326ecf5f36e","repo":"apache/iceberg","slug":"table-does-not-exist-s","errorCode":null,"errorMessage":"Table does not exist: %s","messagePattern":"Table does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchTableException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java","lineNumber":55,"sourceCode":"import org.slf4j.LoggerFactory;\n\npublic abstract class BaseMetastoreCatalog implements Catalog, Closeable {\n  private static final Logger LOG = LoggerFactory.getLogger(BaseMetastoreCatalog.class);\n\n  private MetricsReporter metricsReporter;\n\n  @Override\n  public Table loadTable(TableIdentifier identifier) {\n    Table result;\n    if (isValidIdentifier(identifier)) {\n      TableOperations ops = newTableOps(identifier);\n      if (ops.current() == null) {\n        // the identifier may be valid for both tables and metadata tables\n        if (isValidMetadataIdentifier(identifier)) {\n          result = loadMetadataTable(identifier);\n\n        } else {\n          throw new NoSuchTableException(\"Table does not exist: %s\", identifier);\n        }\n\n      } else {\n        result = new BaseTable(ops, fullTableName(name(), identifier), metricsReporter());\n      }\n\n    } else if (isValidMetadataIdentifier(identifier)) {\n      result = loadMetadataTable(identifier);\n\n    } else {\n      throw new NoSuchTableException(\"Invalid table identifier: %s\", identifier);\n    }\n\n    LOG.info(\"Table loaded by catalog: {}\", result);\n    return result;\n  }\n\n  @Override","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java#L37-L73","documentation":"The catalog resolved the identifier's namespace, but TableOperations.current() returned null — meaning no valid metadata exists at that location — and the name is also not a valid metadata-table identifier. NoSuchTableException is thrown so callers can distinguish 'missing table' from other load failures.","triggerScenarios":"catalog.loadTable(identifier) where the table was never created, was dropped, the identifier has an invalid namespace/name combination, or the underlying metadata location is empty.","commonSituations":"Typos in table name or namespace; stale references after DROP TABLE; Hadoop/Hive metastore entries removed out-of-band; wrong catalog selected for the identifier.","solutions":["Verify the identifier and namespace are correct and the catalog URI points to the right metastore","Check table existence with catalog.tableExists(identifier) before loading","Recreate the table or restore its metadata if it was dropped accidentally","Register the table from a surviving metadata.json via catalog.registerTable if the metadata file still exists"],"exampleFix":"// before\nTable table = catalog.loadTable(TableIdentifier.of(\"db\", \"events\")); // NoSuchTableException\n// after\nTableIdentifier ident = TableIdentifier.of(\"db\", \"events\");\nif (catalog.tableExists(ident)) {\n  Table table = catalog.loadTable(ident);\n} else {\n  table = catalog.registerTable(ident, metadataFileLocation);\n}","handlingStrategy":"try-catch","validationCode":"Preconditions.checkArgument(catalog.tableExists(ident) , \"Table does not exist: \" + ident);","typeGuard":null,"tryCatchPattern":"try { return catalog.loadTable(ident); } catch (NoSuchTableException e) { logger.warn(\"Table missing: {}\", ident, e); return createOrRegister(ident); }","preventionTips":["Verify identifiers against catalog.listTables() before loading","Watch for out-of-band drops in the metastore","Distinguish 'create new' vs 'load existing' paths with tableExists"],"tags":["catalog","no-such-table","lookup"],"backgroundTag":"resource-not-found","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"}