{"record":{"id":"6bc122e717b2a2c4","repo":"benbjohnson/litestream","slug":"find-v0-3-x-snapshot-w","errorCode":null,"errorMessage":"find v0.3.x snapshot: %w","messagePattern":"find v0\\.3\\.x snapshot: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"replica.go","lineNumber":1429,"sourceCode":"\t}\n\n\t// If no v0.3.x backups exist, use LTX.\n\tif v3UpdatedAt.IsZero() {\n\t\treturn false, nil\n\t}\n\n\t// If no LTX backups exist, use v0.3.x.\n\tif ltxUpdatedAt.IsZero() {\n\t\tr.Logger().Debug(\"using v0.3.x restore (no LTX backups)\")\n\t\treturn true, nil\n\t}\n\n\t// Both formats have backups - compare based on timestamp or latest.\n\tif !timestamp.IsZero() {\n\t\t// With timestamp: use format with best snapshot before timestamp.\n\t\tv3Snapshot, err := r.findBestV3SnapshotForTimestamp(ctx, client, timestamp)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"find v0.3.x snapshot: %w\", err)\n\t\t}\n\n\t\tltxSnapshot, err := r.findBestLTXSnapshotForTimestamp(ctx, timestamp)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"find LTX snapshot: %w\", err)\n\t\t}\n\n\t\tif v3Snapshot != nil && (ltxSnapshot == nil || v3Snapshot.CreatedAt.After(ltxSnapshot.CreatedAt)) {\n\t\t\tr.Logger().Debug(\"using v0.3.x restore (better snapshot for timestamp)\",\n\t\t\t\t\"v3_snapshot\", v3Snapshot.CreatedAt,\n\t\t\t\t\"ltx_snapshot\", ltxSnapshot)\n\t\t\treturn true, nil\n\t\t}\n\t} else {\n\t\t// Without timestamp: use format with most recent backup.\n\t\tif v3UpdatedAt.After(ltxUpdatedAt) {\n\t\t\tr.Logger().Debug(\"using v0.3.x restore (more recent backup)\",\n\t\t\t\t\"v3_updated_at\", v3UpdatedAt,","sourceCodeStart":1411,"sourceCodeEnd":1447,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/replica.go#L1411-L1447","documentation":"Wraps an error from findBestV3SnapshotForTimestamp when comparing v0.3.x and LTX snapshots against a requested restore timestamp. Litestream could not enumerate v0.3.x snapshots, so it cannot decide which format holds the best snapshot before the timestamp.","triggerScenarios":"Restore with a -timestamp option where both v0.3.x and LTX backups exist and SnapshotsV3 fails for any generation (same cause family as error 460).","commonSituations":"Timestamp-based PITR against a migrated replica; stale credentials; backend throttling during listing of many generations.","solutions":["Resolve the underlying SnapshotsV3 failure (credentials, network, generation presence).","Retry the timestamp restore; throttled listings usually succeed on retry.","Restore without -timestamp (latest) to bypass the timestamp comparison path.","Reduce generation count/fragmentation by re-replicating into a clean generation."],"exampleFix":"// before\n$ litestream restore -timestamp 2024-01-01T00:00:00Z db\n// error: find v0.3.x snapshot: ...\n// after\n// fix credentials, then retry; or restore latest:\n$ litestream restore db","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := restoreWithTimestamp(ts); err != nil {\n    if strings.Contains(err.Error(), \"find v0.3.x snapshot\") {\n        // fall back to latest restore or fix backend listing then retry\n        return retryOrFallback(err)\n    }\n    return err\n}","preventionTips":["Test timestamp restores during DR drills, not during a real outage.","Watch for provider rate limits when many generations must be listed.","Consolidate fragmented generations via re-replication."],"tags":["restore","v0-3-compat","pitr","snapshot-selection"],"backgroundTag":"api-request-failed","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}