{"record":{"id":"eb2e82f270b96e04","repo":"dgraph-io/dgraph","slug":"not-enough-backups-to-restore-manifest-with-backup","errorCode":null,"errorMessage":"not enough backups to restore manifest with backupNum %d","messagePattern":"not enough backups to restore manifest with backupNum (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/backup_manifest.go","lineNumber":110,"sourceCode":"\t\t\t\tglog.Warningf(\"backup file [%v] missing for backupId [%v] and backupNum [%v]\",\n\t\t\t\t\tpath, m.BackupId, m.BackupNum)\n\t\t\t\tmissingFiles = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !missingFiles {\n\t\t\tvalidManifests = append(validManifests, m)\n\t\t}\n\t}\n\n\tmanifests, err = filter(validManifests, req.BackupId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif req.BackupNum > 0 {\n\t\tif len(manifests) < int(req.BackupNum) {\n\t\t\treturn nil, errors.Errorf(\"not enough backups to restore manifest with backupNum %d\",\n\t\t\t\treq.BackupNum)\n\t\t}\n\t\tmanifests = manifests[len(manifests)-int(req.BackupNum):]\n\t}\n\treturn manifests, nil\n}\n\n// getConsolidatedManifest walks over all the backup directories and generates a master manifest.\nfunc getConsolidatedManifest(h UriHandler, uri *url.URL) (*MasterManifest, error) {\n\t// If there is a master manifest already, we just return it.\n\tif h.FileExists(backupManifest) {\n\t\tmanifest, err := readMasterManifest(h, backupManifest)\n\t\tif err != nil {\n\t\t\treturn &MasterManifest{}, errors.Wrap(err, \"failed to read master manifest: \")\n\t\t}\n\t\treturn manifest, nil\n\t}\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/backup_manifest.go#L92-L128","documentation":"getManifestsToRestore selects the last N manifests (N = req.BackupNum) for a restore. This error is thrown when fewer manifests exist in the location than the requested BackupNum, i.e. the user asked to restore more backups than are available in the backup directory.","triggerScenarios":"Calling restore (RunMapper/handleRestoreProposal/verifyRequest) with --backup-num N (or RestoreRequest.BackupNum = N) when the manifest list at the URI has fewer than N entries.","commonSituations":"User sets -j/--backup-num larger than the number of increments actually taken; lifecycle policies pruned old manifests; pointing restore at a directory that holds only a subset of backups.","solutions":["Lower the requested backup-num to at most the number of manifests present.","Check the backup location and list how many manifest files exist.","Restore the missing older backup parts into the same location.","Run a fresh full backup plus needed increments if the chain cannot be recovered."],"exampleFix":"// before\ndgraph restore --dst s3://bucket/backup --backup-num 10\n# only 3 manifests exist\n// after\ndgraph restore --dst s3://bucket/backup --backup-num 3","handlingStrategy":"validation","validationCode":"if req.BackupNum > 0 {\n    n := countManifests(uri)\n    if int(req.BackupNum) > n {\n        return fmt.Errorf(\"requested %d backups but only %d manifests exist\", req.BackupNum, n)\n    }\n}","typeGuard":"func hasEnoughBackups(reqNum uint64, manifests []Manifest) bool {\n    return reqNum == 0 || uint64(len(manifests)) >= reqNum\n}","tryCatchPattern":null,"preventionTips":["Count manifest files before setting --backup-num","Match --backup-num to the number of increments actually taken","Ensure lifecycle policies do not prune manifests below retention needs"],"tags":["backup","restore","configuration","manifest"],"backgroundTag":"restore-backup-num-exceeds-available","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}