prestodb/presto · error · PrestoException

NOT_FOUND

NOT_FOUND

Error message

Could not move to latest snapshot on table '%s.%s'

What it means

DeltaClient.getSnapshot resolves the Delta table's snapshot; when no explicit snapshot version is requested it asks deltaTable.getLatestSnapshot(deltaEngine). If the Delta log cannot be found, the underlying delta library throws TableNotFoundException, which is wrapped as a PrestoException with StandardErrorCode.NOT_FOUND saying it could not move to the latest snapshot. This means the requested table has no valid Delta transaction log at the location being read.

Source

Thrown at presto-delta/src/main/java/com/facebook/presto/delta/DeltaClient.java:125

    {
        // Fetch the snapshot info for given snapshot version. If no snapshot version is given, get the latest snapshot info.
        // Lock the snapshot version here and use it later in the rest of the query (such as fetching file list etc.).
        // If we don't lock the snapshot version here, the query may end up with schema from one version and data files from another
        // version when the underlying delta table is changing while the query is running.
        Snapshot snapshot;
        if (snapshotId.isPresent()) {
            snapshot = getSnapshotById(deltaTable, deltaEngine, snapshotId.get(), schemaTableName);
        }
        else if (snapshotAsOfTimestampMillis.isPresent()) {
            snapshot = getSnapshotAsOfTimestamp(deltaTable, deltaEngine,
                    snapshotAsOfTimestampMillis.get(), schemaTableName);
        }
        else {
            try {
                snapshot = deltaTable.getLatestSnapshot(deltaEngine); // get the latest snapshot
            }
            catch (TableNotFoundException e) {
                throw new PrestoException(StandardErrorCode.NOT_FOUND,
                        format("Could not move to latest snapshot on table '%s.%s'", schemaTableName.getSchemaName(),
                                schemaTableName.getTableName()), e);
            }
        }

        if (snapshot instanceof SnapshotImpl) {
            String format = ((SnapshotImpl) snapshot).getMetadata().getFormat().getProvider();
            if (!PARQUET.name().equalsIgnoreCase(format)) {
                throw new PrestoException(DeltaErrorCode.DELTA_UNSUPPORTED_DATA_FORMAT,
                        format("Delta table %s has unsupported data format: %s. Only the Parquet data format is supported", schemaTableName, format));
            }
        }
        return snapshot;
    }

    /**
     * Get the list of files corresponding to the given Delta table.
     *

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table's location in the metastore actually contains a _delta_log directory; if it's plain Parquet, convert it (e.g. CONVERT TO DELTA) or register it correctly
  2. Check schema and table names for typos and confirm the table exists in the Delta catalog
  3. If the _delta_log was deleted, restore it from backups or checkpoint/recreate the table
  4. Confirm the connector has read access to the table's storage location and the correct filesystem credentials

Example fix

-- before
SELECT * FROM delta.schema1.table1; -- location points at plain Parquet
-- after
CONVERT TO DELTA parquet.`/path/to/table1`; -- or point the metastore at a real Delta table
SELECT * FROM delta.schema1.table1;
Defensive patterns

Strategy: try-catch

Validate before calling

// before querying: check the table's location actually has a Delta log
Path tablePath = getTableLocation(schemaTableName); // from metastore
Path deltaLog = new Path(tablePath, "_delta_log");
if (!filesystem.exists(deltaLog)) {
    throw new UserError("Location " + tablePath + " has no _delta_log; not a Delta table");
}

Try / catch

try {
    Snapshot snapshot = deltaClient.getSnapshot(schemaTableName, snapshotId);
} catch (PrestoException e) {
    if (e.getErrorCode() == StandardErrorCode.NOT_FOUND.toErrorCodeCode()
            && e.getMessage().contains("Could not move to latest snapshot")) {
        // verify schema/table name and that the location contains _delta_log
        throw new TableNotDeltaException(schemaTableName);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling snapshot() -> getSnapshot() on a schema-qualified table whose Delta log (_delta_log) is missing, deleted, or not yet written — deltaTable.getLatestSnapshot(deltaEngine) throws TableNotFoundException.

Common situations: Querying a path registered as a Delta table but actually not a Delta table (e.g. plain Parquet directory); table dropped or _delta_log removed; wrong location configured for the table in the metastore; typo in schema/table name; writing to the table before the first commit completes.

Understand the failure class

Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/d56f0b235606007f. Report an issue: GitHub.