dgraph-io/dgraph · error
ReceivePredicate failed: Not the leader of group
Error message
ReceivePredicate failed: Not the leader of group
What it means
ReceivePredicate is the gRPC streaming handler on the destination Alpha that ingests a predicate being moved into its group. It is only valid on the group's leader, so if groups().Node.AmLeader() is false when the stream opens, the handler immediately rejects with this error and the move fails.
Source
Thrown at worker/predicate_move.go:122
})
if err != nil {
return err
}
}
if size > 0 {
// Propose remaining keys.
if err := n.proposeAndWait(ctx, proposal); err != nil {
return err
}
}
return nil
}
// Returns count which can be used to verify whether we have moved all keys
// for a predicate or not.
func (w *grpcWorker) ReceivePredicate(stream pb.Worker_ReceivePredicateServer) error {
if !groups().Node.AmLeader() {
return errors.Errorf("ReceivePredicate failed: Not the leader of group")
}
// No new deletion/background cleanup would start after we start streaming tablet,
// so all the proposals for a particular tablet would atmost wait for deletion of
// single tablet. Only leader needs to do this.
mu := groups().blockDeletes
mu.Lock()
defer mu.Unlock()
// Values can be pretty big so having less buffer is safer.
kvs := make(chan *pb.KVS, 3)
che := make(chan error, 1)
// We can use count to check the number of posting lists returned in tests.
count := 0
ctx := stream.Context()
payload := &api.Payload{}
glog.Infof("Got ReceivePredicate. Group: %d. Am leader: %v",
groups().groupId(), groups().Node.AmLeader())View on GitHub (pinned to 759e242be6)
Solutions
- Retry the move — the source leader will re-resolve the destination leader on the next attempt.
- Wait for Raft quorum/leader election to settle on the destination group before moving tablets.
- Verify network connectivity and correct gRPC ports between source leader, destination Alphas, and Zero.
- Check destination Alpha logs for recent leader change events; allow Zero membership to refresh, then re-run movePredicates.
Defensive patterns
Strategy: retry
Validate before calling
dstLeader := zeroClient.LeaderOfGroup(dstGroupId)
if dstLeader == nil {
return errors.New("destination group has no leader yet")
} Try / catch
err := movePredicateStream(ctx, dst)
if err != nil && strings.Contains(err.Error(), "Not the leader of group") {
time.Sleep(backoff) // wait for election, re-resolve leader, retry
} Prevention
- Move tablets only when all groups have a stable elected leader
- Re-resolve the destination leader from Zero membership right before streaming
- Maintain quorum (avoid moving during node restarts/partitions)
- Retry with exponential backoff — leadership is transient
When it happens
Trigger: A source Alpha leader streams a predicate to a destination group whose designated receiver has lost leadership (election in progress, crash, network partition) or whose membership in Zero is stale, so the connection lands on a follower.
Common situations: Destination Alpha restarted during a large tablet move and a new leader elected; Zero's leader cache not yet updated after an election; running a move while the destination group lacks quorum.
Related errors
- Server is not leader of this group
- failed to get connection pool for group %d
- cannot propose restore request
- failed to initiate external snapshot stream: %v
- failed to turn off drain mode: %v
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/5407ba1f0e78eb28.
Report an issue: GitHub.