risingwavelabs/risingwave · error

Iceberg snapshot {snapshot_id} not found

Error message

Iceberg snapshot {snapshot_id} not found

What it means

The iceberg_snapshot_{summary|manifests|files} metadata tables take a snapshot_id; the requested snapshot is looked up via metadata().snapshot_by_id. If no snapshot with that id exists, the scan fails with this error.

Source

Thrown at src/connector/src/sink/iceberg/metadata.rs:181

                    operation: snapshot.summary().operation.as_str().to_owned(),
                    manifest_list: snapshot.manifest_list().to_owned(),
                    summary,
                };
                if let Some(chunk) = append_row(&mut builder, row)? {
                    yield chunk;
                }
            }
        }
        IcebergMetadataTableType::Manifests | IcebergMetadataTableType::Files => {
            let Some(snapshot_id) =
                IcebergSplitEnumerator::get_snapshot_id(&table, time_travel_info)?
            else {
                return Ok(());
            };
            let snapshot = table
                .metadata()
                .snapshot_by_id(snapshot_id)
                .ok_or_else(|| anyhow!("Iceberg snapshot {snapshot_id} not found"))?;
            let metadata = table.metadata_ref();
            let object_cache = table.object_cache();
            let manifest_list = object_cache.get_manifest_list(snapshot, &metadata).await?;

            if metadata_type == IcebergMetadataTableType::Manifests {
                for manifest in manifest_list.entries() {
                    let content = manifest.content.to_string();
                    let row = IcebergManifestRow {
                        content,
                        path: manifest.manifest_path.clone(),
                        length: manifest.manifest_length,
                        partition_spec_id: manifest.partition_spec_id,
                        sequence_number: manifest.sequence_number,
                        min_sequence_number: manifest.min_sequence_number,
                        added_snapshot_id: manifest.added_snapshot_id,
                        added_files_count: optional_u32_to_i32(
                            manifest.added_files_count,
                            "added_files_count",

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Query the snapshots metadata table to list currently valid snapshot ids
  2. Re-run with a valid, existing snapshot_id
  3. Disable/avoid snapshot expiration if you need long-lived snapshot references

Example fix

-- before
SELECT * FROM t.snapshot_files(snapshot_id => 9999999999999999999);
-- after
SELECT * FROM t.snapshots(); -- find a valid id first, then use it
Defensive patterns

Strategy: validation

Validate before calling

let valid_ids: HashSet<i64> = table.metadata().snapshots().map(|s| s.snapshot_id()).collect();
if !valid_ids.contains(&snapshot_id) { return Err(format!("snapshot {snapshot_id} not found")); }

Try / catch

match result {
    Err(e) if e.to_string().contains("not found") => refresh_snapshot_list_and_retry(),
    other => other?,
}

Prevention

When it happens

Trigger: Querying e.g. `SELECT * FROM t.snapshots(...) ` style metadata tables (or function taking snapshot id) with a snapshot id that was expired/removed, a typo'd id, or an id from a different table.

Common situations: Snapshot expired by retention/expired-snapshot cleanup between obtaining the id and querying; using an id captured from an old query against a rewritten table.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/e490d93fda8f0b76. Report an issue: GitHub.