apache/iceberg · error · NoSuchTableException

Cannot rename because the table does not exist in Glue

Error message

Cannot rename %s because the table does not exist in Glue

What it means

GlueCatalog.renameTable throws NoSuchTableException when the Glue GetTable call for the source table fails with EntityNotFoundException. It means the fully-qualified source table name (`db.table`) does not correspond to an existing Glue table in the configured catalog, so there is nothing to rename.

Solutions

  1. Verify the source table exists with `tableExists(from)` or `glue.getTable(...)` before renaming, and check for typos in the database and table name.
  2. Confirm awsProperties.glueCatalogId() and the client region point to the account/region where the table actually lives.
  3. Handle the race where another process dropped the table: re-check and recreate the table if the drop was unintended, or skip the rename.
  4. Check IAM permissions — a denied GetTable can surface as not-found; ensure the role can read the table in Glue.

Example fix

// before
catalog.renameTable("sales.events_old", "sales.events");

// after
TableIdentifier from = TableIdentifier.of("sales", "events_old");
if (catalog.tableExists(from)) {
  catalog.renameTable(from, TableIdentifier.of("sales", "events"));
} else {
  LOG.warn("Skipping rename, source table {} does not exist", from);
}
Defensive patterns

Strategy: try-catch

Validate before calling

TableIdentifier from = TableIdentifier.of("sales", "events_old");
if (!catalog.tableExists(from)) {
  throw new IllegalArgumentException("Source table " + from + " does not exist");
}

Try / catch

try {
  catalog.renameTable(from, to);
} catch (NoSuchTableException e) {
  LOG.error("Rename failed, source {} missing in Glue: {}", from, e.getMessage());
}

Prevention

When it happens

Trigger: Calling catalog.renameTable(from, to) where `from` was already dropped, never created, or the database name is misspelled; or the Glue table exists in a different catalog ID / region than awsProperties.glueCatalogId targets.

Common situations: Typos in table or database names; concurrent pipelines where another job dropped the table between the caller's existence check and the rename; pointing the catalog at the wrong AWS account/region; case-sensitivity mismatches between Iceberg identifiers and Glue names.

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/8d96accd6ec09e59. Report an issue: GitHub.

Appendix: source

Thrown at aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java:425

    String fromTableDbName =
        IcebergToGlueConverter.getDatabaseName(from, awsProperties.glueCatalogSkipNameValidation());
    String fromTableName =
        IcebergToGlueConverter.getTableName(from, awsProperties.glueCatalogSkipNameValidation());
    String toTableDbName =
        IcebergToGlueConverter.getDatabaseName(to, awsProperties.glueCatalogSkipNameValidation());
    String toTableName =
        IcebergToGlueConverter.getTableName(to, awsProperties.glueCatalogSkipNameValidation());
    try {
      GetTableResponse response =
          glue.getTable(
              GetTableRequest.builder()
                  .catalogId(awsProperties.glueCatalogId())
                  .databaseName(fromTableDbName)
                  .name(fromTableName)
                  .build());
      fromTable = response.table();
    } catch (EntityNotFoundException e) {
      throw new NoSuchTableException(
          e, "Cannot rename %s because the table does not exist in Glue", from);
    }

    // use the same Glue info to create the new table, pointing to the old metadata
    TableInput.Builder tableInputBuilder =
        TableInput.builder()
            .owner(fromTable.owner())
            .tableType(fromTable.tableType())
            .parameters(fromTable.parameters())
            .storageDescriptor(fromTable.storageDescriptor());

    glue.createTable(
        CreateTableRequest.builder()
            .catalogId(awsProperties.glueCatalogId())
            .databaseName(toTableDbName)
            .tableInput(tableInputBuilder.name(toTableName).build())
            .build());
    LOG.info("created rename destination table {}", to);

View on GitHub (pinned to 86d9c8fc54)