apache/iceberg · warning

Failed to load table metadata for table

Error message

Failed to load table metadata for table: {}, continuing drop without purge

What it means

Same pattern as the DynamoDB catalog: GlueCatalog.dropTable with purge=true failed to load the table's last metadata (NotFoundException from the table's TableOperations), logs this warning, and continues dropping the Glue table without deleting its data/manifest files. The table disappears from the catalog but files remain in object storage.

Solutions

  1. Verify the table's metadata location in S3 is readable with the configured FileIO (credentials, region, endpoint) before dropping
  2. If data files matter, run RemoveOrphanFiles after the drop to reclaim orphans
  3. Use purge=false when you only want to remove the catalog entry
  4. Re-create or restore the missing metadata JSON if you need a clean purge

Example fix

// before
catalog.dropTable(identifier, true); // metadata unreadable -> purge skipped
// after
Table table = catalog.loadTable(identifier); // verify loadable
// delete via Spark: CALL iceberg.system.remove_orphan_files(...)
catalog.dropTable(identifier, true);
Defensive patterns

Strategy: fallback

Validate before calling

// confirm the Glue table's metadata location is readable
String loc = glue.getTable(...).table().parameters().get("metadata_location");
fileIO.newInputFile(loc).exists(); // false -> purge will be skipped

Prevention

When it happens

Trigger: dropTable(identifier, purge=true) when the Glue table's metadata location is unreadable or already deleted — e.g. metadata JSON removed from S3, wrong S3 endpoint/region config, or leftover Glue entry whose metadata was cleaned earlier.

Common situations: Cleanup scripts that deleted metadata files before dropping the catalog entry; cross-account S3 access problems making the metadata unreadable; re-running a partially failed drop where data files were already purged but the Glue record remained.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

    return results;
  }

  private boolean isGlueIcebergTable(Table table) {
    return table.parameters() != null
        && BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE.equalsIgnoreCase(
            table.parameters().get(BaseMetastoreTableOperations.TABLE_TYPE_PROP));
  }

  @Override
  public boolean dropTable(TableIdentifier identifier, boolean purge) {
    try {
      TableOperations ops = newTableOps(identifier);
      TableMetadata lastMetadata = null;
      if (purge) {
        try {
          lastMetadata = ops.current();
        } catch (NotFoundException e) {
          LOG.warn(
              "Failed to load table metadata for table: {}, continuing drop without purge",
              identifier,
              e);
        }
      }
      glue.deleteTable(
          DeleteTableRequest.builder()
              .catalogId(awsProperties.glueCatalogId())
              .databaseName(
                  IcebergToGlueConverter.getDatabaseName(
                      identifier, awsProperties.glueCatalogSkipNameValidation()))
              .name(identifier.name())
              .build());
      LOG.info("Successfully dropped table {} from Glue", identifier);
      if (purge && lastMetadata != null) {
        CatalogUtil.dropTableData(ops.io(), lastMetadata);
        LOG.info("Glue table {} data purged", identifier);
      }

View on GitHub (pinned to 86d9c8fc54)