{"record":{"id":"fc19e4b004a0fe81","repo":"dgraph-io/dgraph","slug":"map-phase-failed-to-parse-namespace","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":873,"sourceCode":"\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\")\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)","sourceCodeStart":855,"sourceCodeEnd":891,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/restore_map.go#L855-L891","documentation":"During the map phase, DropOperations with DropOp_NS carry the namespace id as a string in op.DropValue. RunMapper parses it with strconv.ParseUint and wraps any parse failure as 'map phase failed to parse namespace', since a non-numeric DropValue would silently corrupt namespace-drop handling.","triggerScenarios":"A manifest's DropOperations entry of type DropOp_NS has DropValue that is not a valid base-0 uint64 (empty, alphabetic, malformed) while processing manifest drop operations in RunMapper.","commonSituations":"Backups produced by versions that encoded namespace drops differently (format mismatch between writer and restorer); hand-edited or corrupted manifest JSON; a bug in the tooling that generated the manifest.","solutions":["Inspect the manifest's DropOperations and confirm DropValue for NS entries is a numeric string (e.g. \"2\").","Restore with a Dgraph version matching the one that produced the backup — the drop-op encoding may differ across versions.","Fix or regenerate the manifest if it was hand-edited or written by third-party tooling.","If the drop op is unimportant, remove that DropOperations entry from a corrected copy of the manifest (advanced, at own risk)."],"exampleFix":"// manifest DropOperations before (corrupt)\n{\"DropOp\":\"NS\",\"DropValue\":\"\"}\n// after\n{\"DropOp\":\"NS\",\"DropValue\":\"2\"}","handlingStrategy":"validation","validationCode":"// validate manifests before restore\nfor _, 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(\"manifest has invalid NS DropValue %q\", op.DropValue)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the same Dgraph version for backup and restore","Never hand-edit manifest DropOperations","Validate manifests with the producing toolchain"],"tags":["dgraph","restore","manifest","namespace","parsing"],"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"}