apache/iceberg · warning

Could not find the table during refresh, setting current…

Error message

Could not find the table during refresh, setting current metadata to null

What it means

A WARN log emitted during refresh() when the table existed in a previously loaded state but the metastore now reports NoSuchTableException. Iceberg nulls out the cached metadata, metadata location, and version so subsequent operations fail with 'not found' semantics rather than operating on stale state. It indicates the table (or view) was dropped by someone else between your load and this refresh.

Solutions

  1. Reload the table from the catalog; if loadTable throws NoSuchTableException, recreate the table or stop the consuming job.
  2. Verify whether the drop was intentional (audit catalog change logs).
  3. For streaming jobs, add logic to detect table deletion and fail fast or recreate with the original schema.
  4. Re-enable your table from backups if the drop was accidental.

Example fix

// before
Table table = catalog.loadTable("db.tbl"); /* long-lived */ ... table.refresh();
// after
Table table;
try { table = catalog.loadTable("db.tbl"); } catch (NoSuchTableException e) { table = recreateTable(); }
Defensive patterns

Strategy: try-catch

Validate before calling

// check existence before refresh
if (!catalog.tableExists(identifier)) { /* recreate or stop */ }

Try / catch

try { table.refresh(); } catch (NoSuchTableException e) { table = catalog.loadTable(id); /* or recreate */ }

Prevention

When it happens

Trigger: Calling Table.refresh() (or any operation triggering doRefresh, like the latestSnapshot accessor with a stale table) after the table was dropped from the catalog by another process; using an expired Table object after DROP TABLE.

Common situations: Long-running Spark/Flink streaming queries holding a Table object while another job drops the table; environments with aggressive table lifecycle policies; accidental drops by CI pipelines.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/af0ca4dd66f0224e. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java:92

    return currentMetadata;
  }

  public String currentMetadataLocation() {
    return currentMetadataLocation;
  }

  public int currentVersion() {
    return version;
  }

  @Override
  public TableMetadata refresh() {
    boolean currentMetadataWasAvailable = currentMetadata != null;
    try {
      doRefresh();
    } catch (NoSuchTableException e) {
      if (currentMetadataWasAvailable) {
        LOG.warn("Could not find the table during refresh, setting current metadata to null", e);
        shouldRefresh = true;
      }

      currentMetadata = null;
      currentMetadataLocation = null;
      version = -1;
      throw e;
    }
    return current();
  }

  protected void doRefresh() {
    throw new UnsupportedOperationException("Not implemented: doRefresh");
  }

  @Override
  public void commit(TableMetadata base, TableMetadata metadata) {
    // if the metadata is already out of date, reject it

View on GitHub (pinned to 86d9c8fc54)