apache/iceberg · error · NoSuchTableException

Cannot find table

Error message

Cannot find table %s

What it means

SnowflakeTableOperations.loadTableMetadataLocation calls the Snowflake client to load the table's Iceberg metadata pointer, and throws NoSuchTableException('Cannot find table %s') when Snowflake returns null — i.e. no Iceberg table metadata exists for that identifier. It surfaces as the standard Iceberg 'table not found' signal to上层 catalog/scan code.

Solutions

  1. Verify the table exists in Snowflake with SHOW ICEBERG TABLES / SELECT in the exact DATABASE.SCHEMA.TABLE the identifier maps to.
  2. Check catalog configuration (catalog name, database/schema mapping) so TableIdentifier namespaces resolve to the correct Snowflake identifiers.
  3. Handle NoSuchTableException in callers (catalog.table() returns null or throws per engine semantics) and use catalog.tableExists() before direct operations access.
  4. Watch identifier case: Snowflake stores uppercase names by default; quote or normalize identifiers to match.

Example fix

// before
Table t = catalog.loadTable(TableIdentifier.of("db", "missing"));
// after
TableIdentifier ident = TableIdentifier.of("db", "missing");
if (!catalog.tableExists(ident)) {
  LOG.warn("Table {} not found in Snowflake catalog", ident);
  return null;
}
Table t = catalog.loadTable(ident);
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.tableExists(identifier)) {
  throw new NoSuchTableException("Table %s does not exist", identifier);
}

Try / catch

try { table = catalog.loadTable(ident); } catch (NoSuchTableException e) { LOG.warn("Table {} missing in Snowflake", ident); return Optional.empty(); }

Prevention

When it happens

Trigger: Accessing table.location()/refresh()/operations on a TableIdentifier that does not exist in Snowflake; identifier namespace parts not matching the Snowflake DATABASE.SCHEMA.TABLE fully-qualified name; table dropped between listing and loading.

Common situations: Typo or wrong catalog name resolution leading to a fully-qualified Snowflake identifier that doesn't exist; querying a table in a different database/schema than configured; race with DROP TABLE; case-sensitivity mismatch on Snowflake identifiers.

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/1cf35678761e1cc7. Report an issue: GitHub.

Appendix: source

Thrown at snowflake/src/main/java/org/apache/iceberg/snowflake/SnowflakeTableOperations.java:85

    return fileIO;
  }

  @Override
  protected String tableName() {
    return fullTableName;
  }

  @VisibleForTesting
  String fullTableName() {
    return tableName();
  }

  private String loadTableMetadataLocation() {
    SnowflakeTableMetadata metadata =
        snowflakeClient.loadTableMetadata(snowflakeIdentifierForTable);

    if (metadata == null) {
      throw new NoSuchTableException("Cannot find table %s", snowflakeIdentifierForTable);
    }

    if (!metadata.getStatus().equals("success")) {
      LOG.warn(
          "Got non-successful table metadata: {} with metadataLocation {} for table {}",
          metadata.getStatus(),
          metadata.icebergMetadataLocation(),
          snowflakeIdentifierForTable);
    }

    return metadata.icebergMetadataLocation();
  }
}

View on GitHub (pinned to 86d9c8fc54)