{"record":{"id":"a7843c20b9dac502","repo":"dgraph-io/dgraph","slug":"backup-request-group-mismatch-mine-d-requested","errorCode":null,"errorMessage":"Backup request group mismatch. Mine: %d. Requested: %d\n","messagePattern":"Backup request group mismatch\\. Mine: (.+?)\\. Requested: (.+?)\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/backup.go","lineNumber":185,"sourceCode":"\treturn errors.Wrapf(err, \"cannot export data inside DB at %s\", dir)\n}\n\n// Backup handles a request coming from another node.\nfunc (w *grpcWorker) Backup(ctx context.Context, req *pb.BackupRequest) (*pb.BackupResponse, error) {\n\tglog.V(2).Infof(\"Received backup request via Grpc: %+v\", req)\n\treturn backupCurrentGroup(ctx, req)\n}\n\nfunc backupCurrentGroup(ctx context.Context, req *pb.BackupRequest) (*pb.BackupResponse, error) {\n\tglog.Infof(\"Backup request: group %d at %d\", req.GroupId, req.ReadTs)\n\tif err := ctx.Err(); err != nil {\n\t\tglog.Errorf(\"Context error during backup: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\tg := groups()\n\tif g.groupId() != req.GroupId {\n\t\treturn nil, errors.Errorf(\"Backup request group mismatch. Mine: %d. Requested: %d\\n\",\n\t\t\tg.groupId(), req.GroupId)\n\t}\n\n\tif err := posting.Oracle().WaitForTs(ctx, req.ReadTs); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcloser, err := g.Node.startTaskAtTs(opBackup, req.ReadTs)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cannot start backup operation\")\n\t}\n\tdefer closer.Done()\n\n\tbp := NewBackupProcessor(pstore, req)\n\tdefer bp.Close()\n\n\treturn bp.WriteBackup(closer.Ctx())\n}","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/backup.go#L167-L203","documentation":"backupCurrentGroup validates that the local worker's group matches the GroupId in the incoming BackupRequest. If the node receiving the backup request belongs to a different raft group than requested, the request is rejected. This guards against routing mistakes where a backup request lands on the wrong shard/group.","triggerScenarios":"A Backup or BackupGroup gRPC request arrives at a worker whose groups().groupId() differs from req.GroupId — e.g. a client sent the backup request to a node not in the target group.","commonSituations":"Stale cluster membership after a rebalance; client/server group configuration out of sync; load balancer routing the request to an arbitrary Alpha/worker node; calling BackupGroup on a node in the wrong group without letting the AnyServer redirect path run.","solutions":["Verify the request is being sent to a server that belongs to the requested group (check group membership via Zero)","Refresh cluster state / restart the client so it picks up current group membership","Fix client code to use the group-discovery path (AnyServer) instead of hardcoding a node","Confirm the cluster's group assignments are stable and the client config GroupId matches an existing group"],"exampleFix":"// before\nres, err := pb.NewWorkerClient(anyNodeConn).Backup(ctx, req) // may hit wrong group\n// after\npl := groups().AnyServer(req.GroupId)\nif pl == nil {\n    return nil, errors.Errorf(\"no server in group %d\", req.GroupId)\n}\nres, err := pb.NewWorkerClient(pl.Get()).Backup(ctx, req)","handlingStrategy":"validation","validationCode":"if groups().groupId() != req.GroupId {\n    return errors.Errorf(\"local group %d cannot serve backup for group %d\", groups().groupId(), req.GroupId)\n}","typeGuard":null,"tryCatchPattern":"resp, err := BackupGroup(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"group mismatch\") {\n    // re-route to a server in req.GroupId via AnyServer and retry once\n}","preventionTips":["Always route backup requests via group discovery (AnyServer) instead of a fixed node","Keep cluster membership views in sync (refresh after rebalances)","Validate GroupId against current membership before issuing the request","Log local groupId at request time to catch routing regressions early"],"tags":["grpc","raft","group-mismatch","distributed"],"backgroundTag":"shard-group-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}