{"record":{"id":"efb9be4020b65172","repo":"kopia/kopia","slug":"error-listing-previous-snapshots-efb9be","errorCode":null,"errorMessage":"error listing previous snapshots","messagePattern":"error listing previous snapshots","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"snapshot/manager.go","lineNumber":255,"sourceCode":"\tif err != nil {\n\t\treturn errors.Wrap(err, \"error saving snapshot\")\n\t}\n\n\tif oldID != newID {\n\t\tif err := rep.DeleteManifest(ctx, oldID); err != nil {\n\t\t\treturn errors.Wrap(err, \"error deleting old manifest\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// FindPreviousManifests returns the list of previous snapshots for a given source, including\n// last complete snapshot and possibly some number of incomplete snapshots following it.\nfunc FindPreviousManifests(ctx context.Context, rep repo.Repository, sourceInfo SourceInfo, noLaterThan *fs.UTCTimestamp) ([]*Manifest, error) {\n\tman, err := ListSnapshots(ctx, rep, sourceInfo)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error listing previous snapshots\")\n\t}\n\n\t// phase 1 - find latest complete snapshot.\n\tvar (\n\t\tpreviousComplete          *Manifest\n\t\tpreviousCompleteStartTime fs.UTCTimestamp\n\t\tresult                    []*Manifest\n\t)\n\n\tfor _, p := range man {\n\t\tif noLaterThan != nil && p.StartTime.After(*noLaterThan) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif p.IncompleteReason == \"\" && (previousComplete == nil || p.StartTime.After(previousComplete.StartTime)) {\n\t\t\tpreviousComplete = p\n\t\t\tpreviousCompleteStartTime = p.StartTime\n\t\t}","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/snapshot/manager.go#L237-L273","documentation":"FindPreviousManifests wraps any failure from ListSnapshots when enumerating prior snapshots for a source. Without the prior snapshot list, incremental snapshotting cannot determine a base, so the operation aborts. It is a wrapper preserving the underlying repository listing error.","triggerScenarios":"Called from createSnapshot/snapshotSingleSource/migrateSingleSourceSnapshot when snapshot.ListSnapshots(ctx, rep, sourceInfo) fails — repository read error, corrupt manifest metadata, or inaccessible storage.","commonSituations":"Blob storage outage or throttling during snapshot creation; corrupted repository indexes; migrating snapshots while the repo is offline or credentials expired.","solutions":["Examine the wrapped underlying error — it names the actual repository/storage failure","Verify the repository is accessible (kopia repository connect / check credentials)","Run 'kopia repository status' or blob-storage health checks for connectivity/throttling","If indexes are corrupt, run 'kopia index recover' or 'kopia maintenance run'"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before creating a snapshot\nif err := rep.Refresh(ctx); err != nil {\n    return fmt.Errorf(\"repository not accessible: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"prev, err := snapshot.FindPreviousManifests(ctx, rep, srcInfo, nil)\nif err != nil {\n    if isTransientStorageError(err) {\n        return retryWithBackoff(func() error { _, err = snapshot.FindPreviousManifests(ctx, rep, srcInfo, nil); return err })\n    }\n    return err\n}","preventionTips":["Check repository connectivity before snapshot operations","Run 'kopia repository status' in health checks","Keep storage credentials rotated before expiry","Run maintenance to keep indexes consistent"],"tags":["storage","manifest","list","repository"],"backgroundTag":"database-query-failed","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"}