{"record":{"id":"87073e643fc9b91f","repo":"dgraph-io/dgraph","slug":"found-a-manifest-with-backup-id-s-but-expected-s","errorCode":null,"errorMessage":"found a manifest with backup ID %s but expected %s","messagePattern":"found a manifest with backup ID (.+?) but expected (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/backup_manifest.go","lineNumber":39,"sourceCode":"\t\"github.com/dgraph-io/dgraph/v25/x\"\n)\n\nfunc verifyManifests(manifests []*Manifest) error {\n\tif len(manifests) == 0 {\n\t\treturn nil\n\t}\n\n\tlastIndex := len(manifests) - 1\n\tif manifests[lastIndex].BackupNum != 1 {\n\t\treturn errors.Errorf(\"expected a BackupNum value of 1 for first manifest but got %d\",\n\t\t\tmanifests[lastIndex].BackupNum)\n\t}\n\n\tbackupId := manifests[lastIndex].BackupId\n\tbackupNum := uint64(len(manifests))\n\tfor _, manifest := range manifests {\n\t\tif manifest.BackupId != backupId {\n\t\t\treturn errors.Errorf(\"found a manifest with backup ID %s but expected %s\",\n\t\t\t\tmanifest.BackupId, backupId)\n\t\t}\n\n\t\tif manifest.BackupNum != backupNum {\n\t\t\treturn errors.Errorf(\"found a manifest with backup number %d but expected %d\",\n\t\t\t\tmanifest.BackupNum, backupNum)\n\t\t}\n\t\tbackupNum--\n\t}\n\n\treturn nil\n}\n\nfunc getManifestsToRestore(h UriHandler, uri *url.URL, req *pb.RestoreRequest) ([]*Manifest, error) {\n\tmanifest, err := GetManifest(h, uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/backup_manifest.go#L21-L57","documentation":"verifyManifests requires every manifest in the list to share the same BackupId as the newest manifest (the backupId captured from the last element). This error is thrown when a manifest from a different backup run (different BackupId) is mixed into the same directory/list, so the set of manifests does not belong to a single backup series.","triggerScenarios":"verifyRequest detects a manifest whose BackupId differs from manifests[lastIndex].BackupId — typically two different `dgraph backup` runs written into the same location, or one backup's manifests overwritten by another run's.","commonSituations":"Pointing multiple backup jobs at the same S3 prefix; restoring a manifest from one backup into a directory of another; re-running backup with a fresh backupId into an existing folder.","solutions":["Separate each backup run into its own destination directory/prefix.","Remove manifests not belonging to the current BackupId from the location.","Re-run backup with a unique, empty destination.","Check for concurrent backup jobs writing to the same path and serialize them."],"exampleFix":"// before\ndgraph backup --dst s3://bucket/shared-prefix\n# second run writes different BackupId into same prefix\n// after\ndgraph backup --dst s3://bucket/backup-$(date +%F-%s)","handlingStrategy":"validation","validationCode":"ids := map[string]bool{}\nfor _, m := range manifests {\n    ids[m.BackupId] = true\n}\nif len(ids) > 1 {\n    return fmt.Errorf(\"multiple BackupIds in %v; separate backup runs\", ids)\n}","typeGuard":"func singleBackupId(m []Manifest) bool {\n    for i := 1; i < len(m); i++ {\n        if m[i].BackupId != m[0].BackupId {\n            return false\n        }\n    }\n    return len(m) > 0\n}","tryCatchPattern":null,"preventionTips":["Give every backup run its own destination prefix","Never let two backup jobs write to the same path concurrently","Check existing BackupId before restoring into a directory"],"tags":["backup","manifest","restore","conflict"],"backgroundTag":"backup-manifest-id-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}