dgraph-io/dgraph · error
br.Close
Error message
br.Close
What it means
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.
Source
Thrown at worker/restore_map.go:858
in := &loadBackupInput{
preds: predSet,
dropNs: localDropNs,
version: manifest.Version,
restoreTs: req.RestoreTs,
// Only map the schema keys corresponding to the latest backup.
keepSchema: i == 0,
compression: manifest.Compression,
fromNamespace: req.FromNamespace,
isNamespaceAwareRestore: req.IsNamespaceAwareRestore,
}
// This would stream the backups from the source, and map them in
// Dgraph compatible format on disk.
if err := mapper.Map(br, in); err != nil {
return nil, errors.Wrap(err, "mapper.Map")
}
if err := br.Close(); err != nil {
return nil, errors.Wrap(err, "br.Close")
}
}
for _, op := range manifest.DropOperations {
switch op.DropOp {
case pb.DropOperation_ALL:
dropAll = true
case pb.DropOperation_DATA:
if op.DropValue == "" {
// In 2103, we do not support namespace level drop data.
dropAll = true
continue
}
ns, err := strconv.ParseUint(op.DropValue, 0, 64)
if err != nil {
return nil, errors.Wrap(err, "map phase failed to parse namespace")
}
dropNs[ns] = struct{}{}
case pb.DropOperation_ATTR:View on GitHub (pinned to 759e242be6)
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.
Defensive patterns
Strategy: retry
Validate before calling
// check network path to the object store before starting
if err := probeBackupLocation(req.Location, creds); err != nil { return err } Try / catch
if _, err := worker.RunMapper(req, mapDir); err != nil {
if strings.Contains(err.Error(), "br.Close") && isTransient(errors.Cause(err)) {
return retryRestore(req, mapDir) // safe: restore aborted before commit
}
return err
} Prevention
- Use stable network paths / VPC endpoints to the object store
- Tune client timeouts for long-running streams
- Monitor object-store error rates during restore
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- cannot retrieve manifests
- while retrieving manifests
- newBackupReader
- unable to reach quorum
- unique validation failed to fetch schema for predicates %v
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/ca259f8e8605f283.
Report an issue: GitHub.