{"record":{"id":"104e6cda5623d80a","repo":"kopia/kopia","slug":"snapshot-not-found","errorCode":null,"errorMessage":"snapshot not found","messagePattern":"snapshot not found","errorType":"error_code","errorClass":"ErrSnapshotNotFound","httpStatus":null,"severity":"error","filePath":"snapshot/manager.go","lineNumber":28,"sourceCode":"\t\"github.com/kopia/kopia/fs\"\n\t\"github.com/kopia/kopia/repo\"\n\t\"github.com/kopia/kopia/repo/logging\"\n\t\"github.com/kopia/kopia/repo/manifest\"\n\t\"github.com/kopia/kopia/repo/object\"\n)\n\n// ManifestType is the value of the \"type\" label for snapshot manifests.\nconst ManifestType = \"snapshot\"\n\n// Manifest labels identifying snapshots.\nconst (\n\tUsernameLabel = \"username\"\n\tHostnameLabel = \"hostname\"\n\tPathLabel     = \"path\"\n)\n\n// ErrSnapshotNotFound is returned when a snapshot is not found.\nvar ErrSnapshotNotFound = errors.New(\"snapshot not found\")\n\nconst (\n\ttypeKey = manifest.TypeLabelKey\n\n\tloadSnapshotsConcurrency = 50 // number of snapshots to load in parallel\n)\n\nvar log = logging.Module(\"kopia/snapshot\")\n\n// ListSources lists all snapshot sources in a given repository.\nfunc ListSources(ctx context.Context, rep repo.Repository) ([]SourceInfo, error) {\n\titems, err := rep.FindManifests(ctx, map[string]string{\n\t\ttypeKey: ManifestType,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to find manifest entries\")\n\t}\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/snapshot/manager.go#L10-L46","documentation":"ErrSnapshotNotFound is the sentinel error snapshot.LoadSnapshot and related APIs return when no snapshot manifest exists for the requested ID or root object ID. It is exported so callers can branch on it with errors.Is instead of string matching.","triggerScenarios":"Calling LoadSnapshot with a manifest ID that does not exist, or CLI commands (snapshot delete/pin/restore) with an ID that is not a snapshot; run() and TestSnapshotsAPI surface it when looking up stale or mistyped snapshot IDs.","commonSituations":"Deleting or pinning a snapshot ID from a different repository; an ID that refers to a non-snapshot manifest; a snapshot already deleted by another client; copy-pasting an object ID instead of a manifest ID.","solutions":["List existing snapshots with 'kopia snapshot list' and use an ID from that output","Check errors.Is(err, snapshot.ErrSnapshotNotFound) in your caller and treat it as an expected, non-fatal case (as command_snapshot_delete.go does)","Verify you are connected to the repository that actually owns the snapshot","If the ID is a root object ID, use FindSnapshotByRootObjectIDOrManifestID instead of assuming a manifest ID"],"exampleFix":"// before\nif _, err := snapshot.LoadSnapshot(ctx, rep, id); err != nil {\n    return err\n}\n// after\nif _, err := snapshot.LoadSnapshot(ctx, rep, id); err != nil {\n    if errors.Is(err, snapshot.ErrSnapshotNotFound) {\n        return nil // nothing to do\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"ids, err := snapshot.ListSnapshotManifests(ctx, rep, nil, true)\n// keep a set of valid manifest IDs and check membership before LoadSnapshot","typeGuard":null,"tryCatchPattern":"_, err := snapshot.LoadSnapshot(ctx, rep, id)\nif errors.Is(err, snapshot.ErrSnapshotNotFound) {\n    // expected case: skip or report 'not found'\n} else if err != nil {\n    return err\n}","preventionTips":["Always branch on errors.Is(err, snapshot.ErrSnapshotNotFound) rather than err != nil","Cross-check snapshot IDs against 'kopia snapshot list' output","Remember snapshots may have been deleted concurrently by another client"],"tags":["snapshot","not-found","manifest"],"backgroundTag":"resource-not-found","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}