{"record":{"id":"ca259f8e8605f283","repo":"dgraph-io/dgraph","slug":"br-close","errorCode":null,"errorMessage":"br.Close","messagePattern":"br\\.Close","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/restore_map.go","lineNumber":858,"sourceCode":"\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\")\n\t\t\t\t}\n\t\t\t\tdropNs[ns] = struct{}{}\n\t\t\tcase pb.DropOperation_ATTR:","sourceCodeStart":840,"sourceCodeEnd":876,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/restore_map.go#L840-L876","documentation":"After mapping, RunMapper explicitly closes the backup reader; if br.Close() returns an error (e.g. failure flushing or closing the underlying object-store stream), it is wrapped as 'br.Close' and aborts the restore. Note there is also a deferred br.Close(); this is the checked, error-propagating close.","triggerScenarios":"br.Close() errors while shutting down the streamed backup object — typically an underlying network/S3 read stream failure, checksum verification on close, or descriptor close error.","commonSituations":"Object-store connection dropped mid/close during long restores; TLS timeouts to S3/GCS/Azure; local file reader for file:// backups hitting I/O errors.","solutions":["Read the wrapped cause; if it is a network/stream error, simply retry the restore.","Check object-store client timeout/retry configuration and network stability between the node and the storage backend.","For file:// locations, check the filesystem/disk health of the backup path.","If the error reproduces at the same point, the backup object may be corrupt — verify or re-take the backup."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// check network path to the object store before starting\nif err := probeBackupLocation(req.Location, creds); err != nil { return err }","typeGuard":null,"tryCatchPattern":"if _, err := worker.RunMapper(req, mapDir); err != nil {\n    if strings.Contains(err.Error(), \"br.Close\") && isTransient(errors.Cause(err)) {\n        return retryRestore(req, mapDir) // safe: restore aborted before commit\n    }\n    return err\n}","preventionTips":["Use stable network paths / VPC endpoints to the object store","Tune client timeouts for long-running streams","Monitor object-store error rates during restore"],"tags":["dgraph","restore","close-error","object-storage","network"],"backgroundTag":"stream-close-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}