{"record":{"id":"55af999759d3f618","repo":"dgraph-io/dgraph","slug":"map-phase-failed-to-parse-namespace-55af99","errorCode":null,"errorMessage":"Map phase failed to parse namespace","messagePattern":"Map phase failed to parse namespace","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/restore_map.go","lineNumber":886,"sourceCode":"\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\")\n\t\t\t\t}\n\t\t\t\tdropNs[ns] = struct{}{}\n\t\t\tcase pb.DropOperation_ATTR:\n\t\t\t\tdropAttr[op.DropValue] = struct{}{}\n\t\t\tcase pb.DropOperation_NS:\n\t\t\t\t// pstore will be nil for export_backup tool. In that case we don't need to ban ns.\n\t\t\t\tif pstore == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// If there is a drop namespace, we just ban the namespace in the pstore.\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.Wrapf(err, \"Map phase failed to parse namespace\")\n\t\t\t\t}\n\t\t\t\tif err := pstore.BanNamespace(ns); err != nil {\n\t\t\t\t\treturn nil, errors.Wrapf(err, \"Map phase failed to ban namespace: %d\", ns)\n\t\t\t\t}\n\t\t\t\tmaxBannedNs = x.Max(maxBannedNs, ns)\n\t\t\t}\n\t\t}\n\t\tglog.Infof(\"[MAP] Processed manifest num: %v\", manifest.BackupNum)\n\t} // done with all the manifests.\n\n\tglog.Infof(\"Histogram of map input sizes:\\n%s\\n\", mapper.szHist)\n\tclose(mapper.reqCh)\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"from processKVList\")\n\t}\n\tif err := mapper.Flush(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to flush the mapper\")\n\t}","sourceCodeStart":868,"sourceCodeEnd":904,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/restore_map.go#L868-L904","documentation":"In the second (post-map) pass over DropOperations, NS drops are applied to pstore via BanNamespace. RunMapper parses op.DropValue again with strconv.ParseUint and wraps parse failures as 'Map phase failed to parse namespace' (capital M), then also wraps any pstore.BanNamespace failure with the same prefix plus the ns id.","triggerScenarios":"While applying NS drop operations when pstore != nil (restore into a live Dgraph, not export_backup), op.DropValue for a DropOp_NS entry is not a valid uint64, or BanNamespace itself fails on the badger store.","commonSituations":"Same manifest format mismatch/corruption as error 958 but hit in the pstore-application path; badger write failure or store closed when banning the namespace during restore into an Alpha/post-restore processor.","solutions":["Check the wrapped cause: a strconv error means the manifest NS DropValue is malformed — fix the manifest or restore with the matching Dgraph version.","A BanNamespace failure (message includes the ns id) indicates a badger/pstore problem — check disk health and that the store is open and writable.","Validate all DropOperations entries in the manifest are well-formed before starting the restore.","Re-take or repair the backup if its manifests are corrupt."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for _, op := range manifest.DropOperations {\n    if op.DropOp == pb.DropOperation_NS {\n        if _, err := strconv.ParseUint(op.DropValue, 0, 64); err != nil {\n            return fmt.Errorf(\"invalid NS DropValue %q in manifest\", op.DropValue)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match restorer version to backup writer version","Ensure the badger pstore is healthy and writable before restore","Sanity-check all DropOperations entries before starting the restore"],"tags":["dgraph","restore","namespace","pstore","manifest"],"backgroundTag":"invalid-drop-value-manifest","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}