kopia/kopia · error

unable to find snapshots by ID

Error message

unable to find snapshots by ID %v

What it means

After successfully parsing the argument as a root object ID, FindSnapshotByRootObjectIDOrManifestID queries the repository for snapshots with that root. This error wraps any failure from snapshot.FindSnapshotsByRootObjectID — typically a repository/manifest-store read failure rather than 'no results found' (an empty result returns nil, nil).

Solutions

  1. Check the wrapped cause for the underlying repository error.
  2. Verify repository connectivity and credentials ('kopia repository status').
  3. Retry the operation; backend errors are often transient.
  4. Run 'kopia repository verify' if manifest corruption is suspected.

Example fix

// before
mans, err := snapshot.FindSnapshotsByRootObjectID(ctx, rep, rootOID)
if err != nil {
    return nil, errors.Wrapf(err, "unable to find snapshots by ID %v", rootID)
}
// after
mans, err := snapshot.FindSnapshotsByRootObjectID(ctx, rep, rootOID)
if err != nil {
    return nil, retryable(errors.Wrapf(err, "unable to find snapshots by ID %v", rootID))
}
Defensive patterns

Strategy: retry

Validate before calling

if err := rep.Refresh(ctx); err != nil {
    return fmt.Errorf("repository unreachable: %w", err)
}

Try / catch

m, err := snapshotfs.FindSnapshotByRootObjectIDOrManifestID(ctx, rep, id)
if err != nil {
    if isTransient(err) { return retryWithBackoff(...) }
    return err
}

Prevention

When it happens

Trigger: Calling FindSnapshotByRootObjectIDOrManifestID when the manifest store query fails — repository connectivity loss, backend errors, or corrupt manifest metadata during the search.

Common situations: Repository backend (S3/BlobStorage etc.) temporarily unavailable; authentication failures when listing manifests; corrupted manifest data after interrupted writes.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/b8571db06c5e2efe. Report an issue: GitHub.

Appendix: source

Thrown at snapshot/snapshotfs/objref.go:96

// FindSnapshotByRootObjectIDOrManifestID returns the list of matching snapshots for a given rootID.
// which can be either snapshot manifest ID (which matches 0 or 1 snapshots)
// or the root object ID (which can match arbitrary number of snapshots).
// If multiple snapshots match and they don't agree on root object attributes and consistentAttributes==true
// the function fails, otherwise it returns the latest of the snapshots.
func FindSnapshotByRootObjectIDOrManifestID(ctx context.Context, rep repo.Repository, rootID string, consistentAttributes bool) (*snapshot.Manifest, error) {
	m, err := snapshot.LoadSnapshot(ctx, rep, manifest.ID(rootID))
	if err == nil {
		return m, nil
	}

	rootOID, err := object.ParseID(rootID)
	if err != nil {
		return nil, errors.Wrap(err, "error parsing root object ID")
	}

	mans, err := snapshot.FindSnapshotsByRootObjectID(ctx, rep, rootOID)
	if err != nil {
		return nil, errors.Wrapf(err, "unable to find snapshots by ID %v", rootID)
	}

	// no matching snapshots.
	if len(mans) == 0 {
		return nil, nil
	}

	// all snapshots have consistent metadata, pick any.
	if areSnapshotsConsistent(mans) {
		return mans[0], nil
	}

	// at this point we found multiple snapshots with the same root ID which don't agree on other
	// metadata (the attributes, ACLs, ownership, etc. of the root)
	if consistentAttributes {
		return nil, errors.Errorf("found multiple snapshots matching %v with inconsistent root attributes", rootID)
	}

View on GitHub (pinned to 82495e54b5)