dgraph-io/dgraph · error
RunRestore failed to write group id file
Error message
RunRestore failed to write group id file
What it means
After successfully flushing the restored DB into the post directory, offline restore writes a GROUP_ID file inside p<gid> identifying which group this posting directory belongs to. If x.WriteGroupIdFile fails (I/O error writing the file), the restore result is rejected because the Alpha would later fail to load the directory without the group marker.
Source
Thrown at worker/online_restore.go:609
WithEncryptionKey(key).
WithNamespaceOffset(x.NamespaceOffset))
if err != nil {
return LoadResult{Err: errors.Wrap(err, "RunRestore failed to open DB")}
}
defer db.Close()
sw := db.NewStreamWriter()
if err := sw.Prepare(); err != nil {
return LoadResult{Err: errors.Wrap(err, "while preparing DB")}
}
if err := RunReducer(sw, mapDir); err != nil {
return LoadResult{Err: errors.Wrap(err, "RunRestore failed to reduce")}
}
if err := sw.Flush(); err != nil {
return LoadResult{Err: errors.Wrap(err, "while stream writer flush")}
}
if err := x.WriteGroupIdFile(pdir, gid); err != nil {
return LoadResult{Err: errors.Wrap(err, "RunRestore failed to write group id file")}
}
}
// TODO: Fix this return value.
return LoadResult{Version: manifest.ValidReadTs()}
}
func buildPredsForDefaultNamespace(restorePreds []string, fromNamespace uint64) []string {
filtered := restorePreds[:0]
for _, pred := range restorePreds {
ns, attr := x.ParseNamespaceAttr(pred)
if fromNamespace == ns {
// update namespace value to 0
pred = x.NamespaceAttr(0, attr)
filtered = append(filtered, pred)
}
}
return filtered
}View on GitHub (pinned to 759e242be6)
Solutions
- Check write permissions/ownership of the target postings directory for the process user (chown/chmod).
- Verify the filesystem is not read-only or full.
- Ensure the p<gid> directory still exists at the end of restore (no external cleanup jobs).
- Retry the restore; if only the group file is missing from an otherwise complete restore, it can be created manually with the group id content before starting Alpha.
Example fix
// before $ dgraph restore -p /data/postings # permission denied writing p1/GROUP_ID // after $ sudo chown -R dgraph:dgraph /data/postings $ dgraph restore -p /data/postings
Defensive patterns
Strategy: validation
Validate before calling
fi, err := os.Stat(dir)
if err != nil {
return err
}
if err := syscall.Access(dir, syscall.O_RDWR); err != nil {
return fmt.Errorf("no write permission on %s", dir)
} Try / catch
if err != nil && strings.Contains(err.Error(), "failed to write group id file") {
// fix permissions/ownership or free space, then re-run restore
} Prevention
- Run restore as the same user that owns the postings directory
- Avoid read-only or quota-limited volumes for postings
- Keep external cleanup jobs from touching the post dir during restore
- Chown the directory to the dgraph user before restoring
When it happens
Trigger: RunOfflineRestore reaches x.WriteGroupIdFile(pdir, gid) and the file write fails: read-only filesystem, no write permission on the post directory, disk full, or the directory was removed/moved mid-restore.
Common situations: Restoring into a directory owned by a different user than the dgraph process; running the restore in a container whose volume switched to read-only; filesystem quota exceeded.
Related errors
- cannot get backup manifests
- error while creating debug file: %s
- Create path failed to create path %s, got error: %v
- File handler failed to create file %s
- another restore operation is already running
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/9d684634633e705a.
Report an issue: GitHub.