{"record":{"id":"927ad59c7b7b0894","repo":"dgraph-io/dgraph","slug":"mapper-map","errorCode":null,"errorMessage":"mapper.Map","messagePattern":"mapper\\.Map","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/restore_map.go","lineNumber":855,"sourceCode":"\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,\n\t\t\t\trestoreTs: req.RestoreTs,\n\t\t\t\t// Only map the schema keys corresponding to the latest backup.\n\t\t\t\tkeepSchema:              i == 0,\n\t\t\t\tcompression:             manifest.Compression,\n\t\t\t\tfromNamespace:           req.FromNamespace,\n\t\t\t\tisNamespaceAwareRestore: req.IsNamespaceAwareRestore,\n\t\t\t}\n\n\t\t\t// This would stream the backups from the source, and map them in\n\t\t\t// Dgraph compatible format on disk.\n\t\t\tif err := mapper.Map(br, in); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"mapper.Map\")\n\t\t\t}\n\t\t\tif err := br.Close(); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"br.Close\")\n\t\t\t}\n\t\t}\n\t\tfor _, op := range manifest.DropOperations {\n\t\t\tswitch op.DropOp {\n\t\t\tcase pb.DropOperation_ALL:\n\t\t\t\tdropAll = true\n\t\t\tcase pb.DropOperation_DATA:\n\t\t\t\tif op.DropValue == \"\" {\n\t\t\t\t\t// In 2103, we do not support namespace level drop data.\n\t\t\t\t\tdropAll = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tns, err := strconv.ParseUint(op.DropValue, 0, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"map phase failed to parse namespace\")","sourceCodeStart":837,"sourceCodeEnd":873,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/restore_map.go#L837-L873","documentation":"RunMapper wraps any error returned by mapper.Map — the streaming step that reads the backup and writes Dgraph-format map files to disk — with 'mapper.Map'. Failures here come from decoding the backup stream or writing the intermediate map buffers.","triggerScenarios":"mapper.Map(br, in) fails mid-stream: corrupted backup data, decode error on a key/value, or an I/O error writing to mapDir buffers (disk full, permissions).","commonSituations":"Disk exhaustion on the node running restore (mapFileSz buffers cannot be written); mapDir not writable; truncated/corrupt backup object; running out of memory/fd limits while streaming large backups.","solutions":["Read the wrapped cause to distinguish decode vs I/O failure.","Check free disk space and write permissions on mapDir (the map-phase scratch directory).","If decode/corruption, verify backup integrity and re-take the backup if needed.","Retry the restore; transient storage errors during long restores are common.","Increase resource limits (fds, memory) if the failure correlates with very large groups."],"exampleFix":"// before\n// mapDir on a nearly full volume\nmapDir := \"/var/tmp/map\"\n// after\n// ensure the scratch dir exists on a volume with space for ~backup size\nos.MkdirAll(mapDir, 0700)\nx.AssertTruef(x.DiskFree(mapDir) > needed, \"insufficient disk for map phase\")","handlingStrategy":"validation","validationCode":"// pre-flight disk/permission check for the map scratch dir\nif err := os.MkdirAll(mapDir, 0700); err != nil { return err }\nif free, _ := diskFree(mapDir); free < requiredBytes { return errors.New(\"insufficient disk for map phase\") }","typeGuard":null,"tryCatchPattern":"if _, err := worker.RunMapper(req, mapDir); err != nil {\n    if strings.Contains(err.Error(), \"mapper.Map\") {\n        return fmt.Errorf(\"map phase failed: check mapDir disk space/permissions and backup integrity: %w\", err)\n    }\n    return err\n}","preventionTips":["Size the map-phase volume for roughly the backup size","Run restores from healthy disks with headroom","Verify backup checksums before long restores"],"tags":["dgraph","restore","map-phase","disk-io"],"backgroundTag":"map-phase-write-failure","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}