prestodb/presto · error · PrestoException
ICEBERG_INVALID_METADATA
ICEBERG_INVALID_METADATA
Error message
Snapshot ID [%s] does not exist for table: %s
What it means
ManifestsTable.buildPages validates the requested snapshot against the table's current snapshots; a snapshot ID that is not present in the table's metadata (expired, wrong handle, or stale cache) triggers this NOT_FOUND-style error naming the snapshot ID and table.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/ManifestsTable.java:118
return new FixedPageSource(ImmutableList.of());
}
return new FixedPageSource(buildPages(tableMetadata, icebergTable, snapshotId.get()));
}
private static List<Page> buildPages(ConnectorTableMetadata tableMetadata, Table icebergTable, long snapshotId)
{
int formatVersion = ((org.apache.iceberg.BaseTable) icebergTable).operations().current().formatVersion();
if (formatVersion > MAX_FORMAT_VERSION_FOR_METADATA_TABLES) {
throw new PrestoException(ICEBERG_INCOMPATIBLE_VERSION,
format("Cannot read Iceberg manifest files for table format version %d (max supported: %d). Upgrade Presto to read this table.",
formatVersion, MAX_FORMAT_VERSION_FOR_METADATA_TABLES));
}
PageListBuilder pagesBuilder = PageListBuilder.forTable(tableMetadata);
Snapshot snapshot = icebergTable.snapshot(snapshotId);
if (snapshot == null) {
throw new PrestoException(ICEBERG_INVALID_METADATA, format("Snapshot ID [%s] does not exist for table: %s", snapshotId, icebergTable));
}
Map<Integer, PartitionSpec> partitionSpecsById = icebergTable.specs();
snapshot.allManifests(icebergTable.io()).forEach(file -> {
pagesBuilder.beginRow();
pagesBuilder.appendVarchar(file.path());
pagesBuilder.appendBigint(file.length());
pagesBuilder.appendInteger(file.partitionSpecId());
pagesBuilder.appendBigint(file.snapshotId());
pagesBuilder.appendInteger(file.addedFilesCount());
pagesBuilder.appendInteger(file.existingFilesCount());
pagesBuilder.appendInteger(file.deletedFilesCount());
writePartitionSummaries(pagesBuilder.nextColumn(), file.partitions(), partitionSpecsById.get(file.partitionSpecId()));
pagesBuilder.endRow();
});
return pagesBuilder.build();View on GitHub (pinned to 55bb57d202)
Solutions
- Query the table without FOR TIMESTAMP/SNAPSHOT to use the current snapshot
- Re-run with a snapshot ID from the SNAPSHOTS metadata table
- If snapshots were expired by retention jobs, use a still-existing snapshot
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/ManifestsTable.java:118 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/f05fc50f04754de6.
Report an issue: GitHub.