{"record":{"id":"3f5dc3ba51a464f1","repo":"grpc/grpc-go","slug":"no-children-to-pick-from","errorCode":null,"errorMessage":"no children to pick from","messagePattern":"no children to pick from","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"balancer/endpointsharding/endpointsharding.go","lineNumber":293,"sourceCode":"\t// the aggregated state, use the pickers present that are currently in that\n\t// state only.\n\tvar aggState connectivity.State\n\tvar pickers []balancer.Picker\n\tif len(readyPickers) >= 1 {\n\t\taggState = connectivity.Ready\n\t\tpickers = readyPickers\n\t} else if len(connectingPickers) >= 1 {\n\t\taggState = connectivity.Connecting\n\t\tpickers = connectingPickers\n\t} else if len(idlePickers) >= 1 {\n\t\taggState = connectivity.Idle\n\t\tpickers = idlePickers\n\t} else if len(transientFailurePickers) >= 1 {\n\t\taggState = connectivity.TransientFailure\n\t\tpickers = transientFailurePickers\n\t} else {\n\t\taggState = connectivity.TransientFailure\n\t\tpickers = []balancer.Picker{base.NewErrPicker(errors.New(\"no children to pick from\"))}\n\t} // No children (resolver error before valid update).\n\tp := &pickerWithChildStates{\n\t\tpickers:     pickers,\n\t\tchildStates: childStates,\n\t\tnext:        uint32(randIntN(len(pickers))),\n\t}\n\tes.cc.UpdateState(balancer.State{\n\t\tConnectivityState: aggState,\n\t\tPicker:            p,\n\t})\n}\n\n// pickerWithChildStates delegates to the pickers it holds in a round robin\n// fashion. It also contains the childStates of all the endpointSharding's\n// children.\ntype pickerWithChildStates struct {\n\tpickers     []balancer.Picker\n\tchildStates []ChildState","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/balancer/endpointsharding/endpointsharding.go#L275-L311","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before — issuing RPC immediately on a channel whose endpoint source is empty\nclient := grpc.NewClient(\"xds:///missing-resource\")\nclient.SayHello(ctx, req) // -> Unavailable: no children to pick from\n\n// after — wait for ready and verify endpoints arrive\nclient := grpc.NewClient(\"xds:///valid-resource\")\nclient.Connect() // trigger exit-idle / resolution\nclient.SayHello(ctx, req, grpc.WaitForReady(true))","handlingStrategy":"validation","validationCode":"// Ensure endpoints exist before issuing RPCs on an endpointsharding channel\nrs, _ := resolver.Get(scheme).Build(...).ResolveNow(...) // or check your resolver emits Endpoints\nif len(rs.Endpoints) == 0 {\n    return errors.New(\"no endpoints; endpointsharding will have no children\")\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"no children to pick from\") {\n    // upstream resolution produced no endpoints; wait or fix resolver/control plane\n}","preventionTips":["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."],"tags":["endpointsharding","balancer","resolver","grpc-go"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}