{"record":{"id":"35334d410d45bb50","repo":"dgraph-io/dgraph","slug":"newbackupreader","errorCode":null,"errorMessage":"newBackupReader","messagePattern":"newBackupReader","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/restore_map.go","lineNumber":825,"sourceCode":"\t\tif dropAll {\n\t\t\tbreak\n\t\t}\n\t\tif manifest.ValidReadTs() == 0 || len(manifest.Groups) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor gid := range manifest.Groups {\n\t\t\tif gid != req.GroupId {\n\t\t\t\t// LoadBackup will try to call the backup function for every group.\n\t\t\t\t// Exit here if the group is not the one indicated by the request.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Only restore the predicates that were assigned to this group at the time\n\t\t\t// of the last backup.\n\t\t\tfile := filepath.Join(manifest.Path, backupName(manifest.ValidReadTs(), gid))\n\t\t\tbr := readerFrom(h, file).WithEncryption(keys.EncKey).WithCompression(manifest.Compression)\n\t\t\tif br.err != nil {\n\t\t\t\treturn nil, errors.Wrap(br.err, \"newBackupReader\")\n\t\t\t}\n\t\t\tdefer br.Close()\n\n\t\t\t// Only map the predicates which haven't been dropped yet.\n\t\t\tpredSet := manifest.getPredsInGroup(gid)\n\t\t\tfor p := range predSet {\n\t\t\t\tif _, ok := dropAttr[p]; ok {\n\t\t\t\t\tdelete(predSet, p)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlocalDropNs := make(map[uint64]struct{})\n\t\t\tfor ns := range dropNs {\n\t\t\t\tlocalDropNs[ns] = struct{}{}\n\t\t\t}\n\t\t\tin := &loadBackupInput{\n\t\t\t\tpreds:     predSet,\n\t\t\t\tdropNs:    localDropNs,\n\t\t\t\tversion:   manifest.Version,","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/restore_map.go#L807-L843","documentation":"readerFrom builds a backup reader for the per-group backup file (backupName at manifest.ValidReadTs); any error constructing it (missing object, unreadable stream, decryption/compression setup failure) is stored on the reader's err field and re-surfaced by RunMapper wrapped as 'newBackupReader'.","triggerScenarios":"The backup object for a given group (gid) at file = manifest.Path/backupName(manifest.ValidReadTs(), gid) does not exist or cannot be opened; the WithEncryption key is wrong for this backup; the reader cannot be set up with the manifest's compression codec.","commonSituations":"Partial or incomplete backup where one group's file is missing; object deleted or lifecycle-ruled away in the store; restoring with the wrong encryption key for that backup generation; backup written with a compression codec unsupported by the current binary.","solutions":["Check the wrapped cause: 'not found' means the group's backup file is missing — verify the backup completed fully (all group files present at manifest.Path).","Confirm the encryption key (keys.EncKey) matches the one used when the backup was created.","Verify the manifest's Compression codec is supported by this Dgraph version (upgrade if the backup is newer).","Re-list/re-validate the manifest objects and re-run; if the backup is incomplete, take a new backup."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure every group's backup file exists at the manifest path before restore\nfor _, gid := range groupIds {\n    if !objectExists(manifest.Path, backupName(ts, gid)) {\n        return fmt.Errorf(\"backup file for group %d missing\", gid)\n    }\n}","typeGuard":null,"tryCatchPattern":"br := readerFrom(h, file).WithEncryption(keys.EncKey).WithCompression(manifest.Compression)\nif br.err != nil {\n    // wrapped by RunMapper as \"newBackupReader\"\n    return fmt.Errorf(\"cannot open group backup (check completeness/encryption key): %w\", br.err)\n}","preventionTips":["Verify all group files exist after every backup","Use lifecycle rules that never expire backup objects mid-restore","Keep encryption keys and compression codecs consistent between writer and restorer"],"tags":["dgraph","restore","backup-reader","object-storage","encryption"],"backgroundTag":"backup-object-open-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}