{"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/0c51461d27177d997e14c642fe18c11668fc09a3/balancer/endpointsharding/endpointsharding.go#L275-L311","documentation":"Thrown by ParseFilterConfig when the proto.Message for the Router filter is non-nil but is not *anypb.Any. The xDS framework always encodes filter configs as *anypb.Any; receiving another type signals a caller bug or a proto type mismatch between the framework and the filter builder.","triggerScenarios":"A custom httpfilter dispatch path or test harness passes a *pb.Router directly to ParseFilterConfig instead of wrapping it in *anypb.Any. A grpc-go fork changed the httpfilter.Builder interface contract. Proto import path divergence causes the anypb.Any type seen by the builder to differ from the one passed.","commonSituations":"Unit tests of the xdsclient filter unmarshalling that construct filter configs without anypb.New. A mixed-dependency build where google.golang.org/protobuf and github.com/golang/protobuf Any types are interchanged. An internal refactor that bypasses the standard Any wrapping.","solutions":["Always pass *anypb.Any to ParseFilterConfig — wrap with anypb.New(&pb.Router{}).","Ensure all proto imports use google.golang.org/protobuf/types/known/anypb consistently; avoid mixing github.com/golang/protobuf/ptypes/any.","If the error comes from production xDS flow, verify the grpc-go module version is uniform across the build (go mod why google.golang.org/grpc)."],"exampleFix":"// before:\ncfg, err := b.ParseFilterConfig(&pb.Router{})\n\n// after:\nany, _ := anypb.New(&pb.Router{})\ncfg, err := b.ParseFilterConfig(any)","handlingStrategy":"type-guard","validationCode":"// Ensure cfg is *anypb.Any before dispatching to ParseFilterConfig:\nfunc safeParseConfig(b httpfilter.Builder, cfg proto.Message) (httpfilter.FilterConfig, error) {\n    any, ok := cfg.(*anypb.Any)\n    if !ok {\n        return nil, fmt.Errorf(\"expected *anypb.Any, got %T\", cfg)\n    }\n    return b.ParseFilterConfig(any)\n}","typeGuard":"func isAnypbAny(msg proto.Message) bool {\n    _, ok := msg.(*anypb.Any)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Standardize on google.golang.org/protobuf/types/known/anypb across the entire build.","In test code, use a factory helper: func anyOf(m proto.Message) *anypb.Any { a, _ := anypb.New(m); return a }.","Run go mod tidy and verify there are no competing protobuf versions."],"tags":["xds","router","grpc","type-assertion","proto"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}