grpc/grpc-go · error
no children to pick from
Error message
no children to pick from
What it means
Internal error produced by the endpointsharding balancer (balancer/endpointsharding/endpointsharding.go:291-294) when its children list is empty — there are zero child balancers to pick from. It wraps the message in a base.NewErrPicker and aggregates to TransientFailure. The inline comment 'No children (resolver error before valid update)' describes the cause.
Source
Thrown at balancer/endpointsharding/endpointsharding.go:293
// the aggregated state, use the pickers present that are currently in that
// state only.
var aggState connectivity.State
var pickers []balancer.Picker
if len(readyPickers) >= 1 {
aggState = connectivity.Ready
pickers = readyPickers
} else if len(connectingPickers) >= 1 {
aggState = connectivity.Connecting
pickers = connectingPickers
} else if len(idlePickers) >= 1 {
aggState = connectivity.Idle
pickers = idlePickers
} else if len(transientFailurePickers) >= 1 {
aggState = connectivity.TransientFailure
pickers = transientFailurePickers
} else {
aggState = connectivity.TransientFailure
pickers = []balancer.Picker{base.NewErrPicker(errors.New("no children to pick from"))}
} // No children (resolver error before valid update).
p := &pickerWithChildStates{
pickers: pickers,
childStates: childStates,
next: uint32(randIntN(len(pickers))),
}
es.cc.UpdateState(balancer.State{
ConnectivityState: aggState,
Picker: p,
})
}
// pickerWithChildStates delegates to the pickers it holds in a round robin
// fashion. It also contains the childStates of all the endpointSharding's
// children.
type pickerWithChildStates struct {
pickers []balancer.Picker
childStates []ChildStateView on GitHub (pinned to 03255a9237)
Solutions
- Ensure the resolver actually supplies endpoints — endpointsharding keys children off resolver.State.Endpoints, so an empty Endpoints slice yields no children.
- Wait for the first valid resolver/LB update before issuing RPCs, or use grpc.WaitForReady(true).
- If configuring endpointsharding directly, confirm childPolicy and the endpoint list are populated; check the parent policy (xDS resource exists and is healthy).
- Look at channelz / connectivity: a persistent TransientFailure with this picker means upstream resolution never succeeded — fix the resolver/control plane.
Example fix
// before — issuing RPC immediately on a channel whose endpoint source is empty
client := grpc.NewClient("xds:///missing-resource")
client.SayHello(ctx, req) // -> Unavailable: no children to pick from
// after — wait for ready and verify endpoints arrive
client := grpc.NewClient("xds:///valid-resource")
client.Connect() // trigger exit-idle / resolution
client.SayHello(ctx, req, grpc.WaitForReady(true)) Defensive patterns
Strategy: validation
Validate before calling
// Ensure endpoints exist before issuing RPCs on an endpointsharding channel
rs, _ := resolver.Get(scheme).Build(...).ResolveNow(...) // or check your resolver emits Endpoints
if len(rs.Endpoints) == 0 {
return errors.New("no endpoints; endpointsharding will have no children")
} Try / catch
if strings.Contains(err.Error(), "no children to pick from") {
// upstream resolution produced no endpoints; wait or fix resolver/control plane
} Prevention
- Confirm resolver.State.Endpoints is populated before relying on endpointsharding.
- Use grpc.WaitForReady(true) on channels backed by slow xDS resolvers.
- Watch channelz for the endpointsharding child list during startup.
When it happens
Trigger: endpointsharding.generatePickerState finds no children at all: len(readyPickers)+connecting+idle+transientFailure all zero. This happens before the first valid resolver update delivers any endpoint, or after every endpoint/child has been removed.
Common situations: Used as a sub-policy (e.g. under xds / cluster_resolver / weightedtarget) before the first xDS response; resolver returned resolver.State with no Endpoints; all endpoints drained during a config update; misconfigured endpointsharding with no child policy producing children.
Related errors
- bad resolver state
- no SubConn is available
- all SubConns are in TransientFailure
- weighted-target: no targets to pick from
- last resolver error: %v
AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07).
Data as JSON: /api/errors/3f5dc3ba51a464f1.
Report an issue: GitHub.