{"record":{"id":"2d9ad2dac1a20b16","repo":"benbjohnson/litestream","slug":"no-backups-found","errorCode":null,"errorMessage":"no backups found","messagePattern":"no backups found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"replica.go","lineNumber":587,"sourceCode":"\t// Also check v0.3.x time bounds if client supports it.\n\tif client, ok := r.Client.(ReplicaClientV3); ok {\n\t\tv3CreatedAt, v3UpdatedAt, err := r.TimeBoundsV3(ctx, client)\n\t\tif err != nil {\n\t\t\treturn time.Time{}, fmt.Errorf(\"v0.3.x time bounds: %w\", err)\n\t\t}\n\t\t// Extend time bounds to include v0.3.x backups.\n\t\tif !v3CreatedAt.IsZero() && (createdAt.IsZero() || v3CreatedAt.Before(createdAt)) {\n\t\t\tcreatedAt = v3CreatedAt\n\t\t}\n\t\tif !v3UpdatedAt.IsZero() && (updatedAt.IsZero() || v3UpdatedAt.After(updatedAt)) {\n\t\t\tupdatedAt = v3UpdatedAt\n\t\t}\n\t}\n\n\t// Skip if it does not contain timestamp.\n\tif !opt.Timestamp.IsZero() {\n\t\tif createdAt.IsZero() && updatedAt.IsZero() {\n\t\t\treturn time.Time{}, fmt.Errorf(\"no backups found\")\n\t\t}\n\t\tif opt.Timestamp.Before(createdAt) || opt.Timestamp.After(updatedAt) {\n\t\t\treturn time.Time{}, fmt.Errorf(\"timestamp does not exist\")\n\t\t}\n\t}\n\n\treturn updatedAt, nil\n}\n\n// Replica restores the database from a replica based on the options given.\n// This method will restore into opt.OutputPath, if specified, or into the\n// DB's original database path. It can optionally restore from a specific\n// replica or it will automatically choose the best one. Finally,\n// a timestamp can be specified to restore the database to a specific\n// point-in-time.\n//\n// When the replica contains both v0.3.x and LTX format backups, this method\n// compares snapshots from both formats and uses whichever has the better backup:","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/replica.go#L569-L605","documentation":"When RestoreOptions.Timestamp is set, CalcRestoreTarget requires known time bounds (createdAt/updatedAt) to validate the requested timestamp. If both bounds are zero — meaning no backups of any format were found in the replica — restore target computation fails with 'no backups found'. It indicates the replica has nothing restorable, not that the timestamp is out of range.","triggerScenarios":"CalcRestoreTarget (and thus restore with -timestamp) is called on a replica whose storage contains no LTX files and no legacy backups, so TimeBounds/TimeBoundsV3 returned zero timestamps.","commonSituations":"Typo in config bucket/prefix pointing at an empty location; a replica that never completed its first sync; storage cleaned by lifecycle policies; using the wrong replica name in restore command.","solutions":["Verify the replica actually has backups: run `litestream ltx` / list the storage location.","Check the config's bucket/prefix/replica path points to the location containing backups.","Run a sync (`litestream replicate`) to create an initial backup before restoring.","If backups were deleted by retention/lifecycle policies, restore from a different replica or snapshot."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check the replica has backups before a timestamped restore\ninfos, err := client.ListLTXFiles(ctx, 0)\nif err != nil || len(infos) == 0 {\n    return fmt.Errorf(\"replica %s has no backups\", replicaName)\n}","typeGuard":null,"tryCatchPattern":"err := replica.Restore(ctx, opt)\nif err != nil && errors.Is(err, errors.New(\"no backups found\")) || strings.Contains(err.Error(), \"no backups found\") {\n    // fall back to another replica or create a fresh backup first\n}","preventionTips":["Confirm backups exist with `litestream ltx` before planning restores","Verify bucket/prefix/replica name in config points at the populated location","Watch for lifecycle policies deleting objects litestream still references"],"tags":["restore","no-backups","empty-replica"],"backgroundTag":"empty-result-set","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}