apache/iceberg · error · NoSuchTableException
Cannot find table %s to drop
Error message
Cannot find table %s to drop
What it means
DynamoDbCatalog.dropTable() first reads the table's item with a consistent GetItem; if no item is found it throws NoSuchTableException with this message. Dropping requires the table row to exist because the catalog must read its metadata location before removing or purging it.
Source
Thrown at aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbCatalog.java:387
lastEvaluatedKey = response.lastEvaluatedKey();
} while (!lastEvaluatedKey.isEmpty());
return identifiers;
}
@Override
public boolean dropTable(TableIdentifier identifier, boolean purge) {
Map<String, AttributeValue> key = tablePrimaryKey(identifier);
try {
GetItemResponse response =
dynamo.getItem(
GetItemRequest.builder()
.tableName(awsProperties.dynamoDbTableName())
.consistentRead(true)
.key(key)
.build());
if (!response.hasItem()) {
throw new NoSuchTableException("Cannot find table %s to drop", identifier);
}
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);
}
}
dynamo.deleteItem(
DeleteItemRequest.builder()
.tableName(awsProperties.dynamoDbTableName())
.key(tablePrimaryKey(identifier))View on GitHub (pinned to 86d9c8fc54)
Solutions
- Guard with catalog.tableExists(identifier) before dropping, or treat a false dropTable() return value as already-dropped (dropTable returns boolean).
- Verify the identifier and catalog configuration (DynamoDB table name, region) match the environment that owns the table.
- Catch org.apache.iceberg.exceptions.NoSuchTableException and treat it as success in idempotent cleanup code.
Example fix
// before
boolean dropped = catalog.dropTable(TableIdentifier.of("analytics", "events"), true);
// after
TableIdentifier id = TableIdentifier.of("analytics", "events");
if (catalog.tableExists(id)) {
catalog.dropTable(id, true);
} Defensive patterns
Strategy: validation
Validate before calling
TableIdentifier id = TableIdentifier.of("analytics", "events");
if (catalog.tableExists(id)) {
catalog.dropTable(id, true);
} Try / catch
try {
catalog.dropTable(id, true);
} catch (NoSuchTableException e) {
// already dropped; idempotent cleanup
} Prevention
- Treat dropTable's boolean return and NoSuchTableException as 'already gone' in retries
- Verify the identifier and environment before destructive operations
- Avoid concurrent drops of the same table
When it happens
Trigger: Calling catalog.dropTable(identifier) or dropTable(identifier, purge) when the DynamoDB catalog table contains no item for the given table identifier — the table was already dropped, never existed, or the identifier is wrong.
Common situations: Double-execution of a drop in retry/race scenarios; referencing a table in a different environment or wrong DynamoDB table name; case-sensitive identifier mismatches; concurrent jobs dropping the same table.
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
- Cannot rename table %s to %s: %s does not exist
- Cannot find Dynamo catalog table %s
- Cannot find default warehouse location: namespace %s does no
- Cannot create namespace %s: already exists
- Cannot find namespace %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/2bcb00c833a9e642.
Report an issue: GitHub.