Skip to content
ReviveDB
Blog

Supabase Storage backup: "Object not found" for a file that is listed

By ReviveDB

{"code":"NoSuchKey","message":"Object not found"}

A listed Supabase Storage path can return "Object not found" when a backup downloads it. Confirm the NoSuchKey error code, retry the path once and record it as missing at source if the retry agrees. Do not treat another error as a missing file.

A row without a file

storage.objects is the catalogue of a bucket. A row can remain when its file bytes are unavailable, or a file can disappear after the backup lists it. The row alone does not prove that the file can be downloaded.

Supabase documents NoSuchKey with HTTP 404. The source API can also return it with HTTP 400. Check the code in the response body, because the status and the words "Object not found" are not enough. A response without NoSuchKey can be a different failure and needs investigation.

Count rows against files

select bucket_id, count(*)
from storage.objects
group by bucket_id;

Compare the listed count with copied files per bucket and retain the exact paths that returned NoSuchKey. Those paths are missing from the recovery point. Do not report the listed and copied counts as equal.

Retry, then record missing paths

A deletion between listing and download can produce NoSuchKey, so retry once. If it persists, record the bucket and path as missing at source and continue with the files still available. An unknown bucket, refused key or response without NoSuchKey should fail the run rather than be silently skipped.

Investigate a persistent missing path in the source project. Do not delete rows from storage.objects with SQL to make the backup count match.

ReviveDB retries NoSuchKey once, records paths still missing at source and hash-checks every Storage file it copies. Other download failures stop the backup. How to back up Storage files covers the rest of the copy.