dgraph-io/dgraph · error
Unable to reach leader of group: %d
Error message
Unable to reach leader of group: %d
What it means
Zero cannot obtain a gRPC connection to the RAFT leader of the given group while executing predicate deletion. The group exists in the membership state but s.Leader(gid) returned nil, meaning no healthy leader address is known to Zero (leader down, not yet elected, or membership maps out of sync). deletePredicates aborts and the caller only logs a warning, so cleanup is skipped.
Source
Thrown at dgraph/cmd/zero/zero.go:815
for _, tablet := range group.Tablets {
gid = tablet.GroupId
break
}
if gid == 0 {
return errors.Errorf("Unable to find group")
}
state, err := s.latestMembershipState(ctx)
if err != nil {
return err
}
sg, ok := state.Groups[gid]
if !ok {
return errors.Errorf("Unable to find group: %d", gid)
}
pl := s.Leader(gid)
if pl == nil {
return errors.Errorf("Unable to reach leader of group: %d", gid)
}
wc := pb.NewWorkerClient(pl.Get())
for pred := range group.Tablets {
if _, found := sg.Tablets[pred]; found {
continue
}
glog.Infof("Tablet: %v does not belong to group: %d. Sending delete instruction.",
pred, gid)
in := &pb.MovePredicatePayload{
Predicate: pred,
SourceGid: gid,
DestGid: 0,
}
if _, err := wc.MovePredicate(ctx, in); err != nil {
return err
}
}View on GitHub (pinned to 759e242be6)
Solutions
- Verify all Alphas of the group are running and connected to Zero (check /health and Zero's /state endpoint).
- Retry the predicate drop after the group elects a leader; the error is transient during elections.
- Check network/firewall connectivity between Zero and the Alpha servers on their gRPC ports.
- If the group should no longer exist (removed Alphas), wait for Zero's membership state to converge or use cleanupTool/dgraph zero removal for dead nodes.
Example fix
// before
curl -X POST localhost:8080/admin -d '{"query":"mutation { dropOp(pattern: "name") { response { message } } }"}' # fails while group leader is down
// after
# restart the down Alpha first, confirm leader in Zero /state, then re-run the drop Defensive patterns
Strategy: retry
Validate before calling
// Before dropping predicates, check Zero's membership state
const res = await fetch('http://zero:6080/state');
const state = await res.json();
const group = state.groups && state.groups[gid];
if (!group || !group.members || !group.members.some(m => m.leader && m.healthy === true)) {
throw new Error(`Group ${gid} has no healthy leader; defer predicate drop`);
} Type guard
function hasHealthyLeader(group) {
return Boolean(group && Array.isArray(group.members) &&
group.members.some(m => m.leader === true && m.healthy === true));
} Try / catch
try {
await dropPredicate(pattern);
} catch (err) {
if (/Unable to reach leader of group/.test(String(err))) {
await waitForGroupLeader(gid); // poll /state until leader healthy
await dropPredicate(pattern); // retry once leader is up
} else {
throw err;
}
} Prevention
- Monitor Alpha health and RAFT leader status before issuing drops
- Avoid dropping predicates during cluster maintenance, restarts, or elections
- Alert on Zero/Alpha connectivity loss so cleanup windows are chosen deliberately
- Keep an odd number of Alpha replicas per group so a leader always exists
When it happens
Trigger: A drop of a predicate triggers MovePredicate cleanup via UpdateMembership; Zero knows the group/tablets from a stale membership snapshot but the leader of that group has crashed, been restarted, or has not yet been elected when deletePredicates calls s.Leader(gid).
Common situations: Alpha process in the group crashed or is restarting during a schema drop; network partition between Zero and the group's Alphas; a single-node group whose member is down; dropping predicates right after resizing a cluster.
Related errors
- group: [%d] is not a known group
- namespace: %d. No tablet found for: %s
- namespace: %d. Tablet: [%s] is already being served by group
- Unable to move reserved predicate %s
- Tablet to be moved: [%v] is not being served
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/f67b87bcc0f08087.
Report an issue: GitHub.