apache/iceberg · error · NoSuchTableException

Table does not exist: %s

Error message

Table does not exist: %s

What it means

Thrown by NessieIcebergClient.validateFromContentForRename when renaming Iceberg tables but the source identifier does not resolve to any content on the current Nessie ref (existingFromContent == null). The NoSuchTableException tells the caller the rename source table is absent. It is raised from renameContent before any Nessie commit is attempted.

Source

Thrown at nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java:536

      if (existingToContent.getType() == Content.Type.ICEBERG_VIEW) {
        throw new AlreadyExistsException("Cannot rename %s to %s. View already exists", from, to);
      } else if (existingToContent.getType() == Content.Type.ICEBERG_TABLE) {
        throw new AlreadyExistsException("Cannot rename %s to %s. Table already exists", from, to);
      } else {
        throw new AlreadyExistsException(
            "Cannot rename %s to %s. Another content of type %s with same name already exists",
            from, to, existingToContent.getType());
      }
    }
  }

  private static void validateFromContentForRename(
      TableIdentifier from, Content.Type type, IcebergContent existingFromContent) {
    if (existingFromContent == null) {
      if (type == Content.Type.ICEBERG_VIEW) {
        throw new NoSuchViewException("View does not exist: %s", from);
      } else if (type == Content.Type.ICEBERG_TABLE) {
        throw new NoSuchTableException("Table does not exist: %s", from);
      } else {
        throw new RuntimeException("Cannot perform rename for content type: " + type);
      }
    } else if (existingFromContent.getType() != type) {
      throw new RuntimeException(
          String.format("content type of from identifier %s should be of %s", from, type));
    }
  }

  public boolean dropTable(TableIdentifier identifier, boolean purge) {
    return dropContent(identifier, purge, Content.Type.ICEBERG_TABLE);
  }

  public boolean dropView(TableIdentifier identifier, boolean purge) {
    return dropContent(identifier, purge, Content.Type.ICEBERG_VIEW);
  }

  private boolean dropContent(TableIdentifier identifier, boolean purge, Content.Type type) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check catalog.tableExists(from) on the same client/ref before renaming.
  2. Point the catalog at the correct Nessie branch/tag (client.ref / catalog property 'ref' or 'asset-ref').
  3. Correct the from identifier (namespace + name spelling and case).
  4. Catch NoSuchTableException and handle idempotently if renames may run repeatedly.

Example fix

// before
catalog.renameTable(TableIdentifier.of("ns", "events"), TableIdentifier.of("ns", "events_v2")); // fails on wrong branch
// after
catalog.setRef("main");
TableIdentifier from = TableIdentifier.of("ns", "events");
if (catalog.tableExists(from)) {
  catalog.renameTable(from, TableIdentifier.of("ns", "events_v2"));
}
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.tableExists(from)) { throw new IllegalStateException("Table not found: " + from); }

Try / catch

try { catalog.renameTable(from, to); } catch (NoSuchTableException e) { /* source missing on ref */ }

Prevention

When it happens

Trigger: catalog.renameTable(from, to) where from does not exist on the pinned ref, or from exists only on another branch/tag, or from is actually a view being renamed via the table API with a mismatched type expectation path.

Common situations: Wrong Nessie branch configured in catalog properties; table dropped concurrently by another job; case-sensitive name mismatch; renaming across refs where the source ref lacks the table.

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/5893c69c05fbaec7. Report an issue: GitHub.