{"record":{"id":"f05fc50f04754de6","repo":"prestodb/presto","slug":"iceberg-invalid-metadata-f05fc5","errorCode":"ICEBERG_INVALID_METADATA","errorMessage":"Snapshot ID [%s] does not exist for table: %s","messagePattern":"Snapshot ID \\[(.+?)\\] does not exist for table: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/ManifestsTable.java","lineNumber":118,"sourceCode":"            return new FixedPageSource(ImmutableList.of());\n        }\n        return new FixedPageSource(buildPages(tableMetadata, icebergTable, snapshotId.get()));\n    }\n\n    private static List<Page> buildPages(ConnectorTableMetadata tableMetadata, Table icebergTable, long snapshotId)\n    {\n        int formatVersion = ((org.apache.iceberg.BaseTable) icebergTable).operations().current().formatVersion();\n        if (formatVersion > MAX_FORMAT_VERSION_FOR_METADATA_TABLES) {\n            throw new PrestoException(ICEBERG_INCOMPATIBLE_VERSION,\n                    format(\"Cannot read Iceberg manifest files for table format version %d (max supported: %d). Upgrade Presto to read this table.\",\n                            formatVersion, MAX_FORMAT_VERSION_FOR_METADATA_TABLES));\n        }\n\n        PageListBuilder pagesBuilder = PageListBuilder.forTable(tableMetadata);\n\n        Snapshot snapshot = icebergTable.snapshot(snapshotId);\n        if (snapshot == null) {\n            throw new PrestoException(ICEBERG_INVALID_METADATA, format(\"Snapshot ID [%s] does not exist for table: %s\", snapshotId, icebergTable));\n        }\n\n        Map<Integer, PartitionSpec> partitionSpecsById = icebergTable.specs();\n\n        snapshot.allManifests(icebergTable.io()).forEach(file -> {\n            pagesBuilder.beginRow();\n            pagesBuilder.appendVarchar(file.path());\n            pagesBuilder.appendBigint(file.length());\n            pagesBuilder.appendInteger(file.partitionSpecId());\n            pagesBuilder.appendBigint(file.snapshotId());\n            pagesBuilder.appendInteger(file.addedFilesCount());\n            pagesBuilder.appendInteger(file.existingFilesCount());\n            pagesBuilder.appendInteger(file.deletedFilesCount());\n            writePartitionSummaries(pagesBuilder.nextColumn(), file.partitions(), partitionSpecsById.get(file.partitionSpecId()));\n            pagesBuilder.endRow();\n        });\n\n        return pagesBuilder.build();","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/ManifestsTable.java#L100-L136","documentation":"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.","triggerScenarios":"Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/ManifestsTable.java:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}