{"record":{"id":"a7df519388f60fe4","repo":"grpc/grpc-go","slug":"rls-invalid-childpolicy-config-no-supported-poli","errorCode":null,"errorMessage":"rls: invalid childPolicy config: no supported policies found in %+v","messagePattern":"rls: invalid childPolicy config: no supported policies found in %\\+v","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"balancer/rls/config.go","lineNumber":322,"sourceCode":"\t\t// - unmarshal the raw JSON bytes of the child policy config into a map\n\t\t// - add an entry with key set to `target_field_name` and a dummy value\n\t\t// - marshal the map back to JSON and parse the config using the parser\n\t\t// retrieved previously\n\t\tvar childConfig map[string]json.RawMessage\n\t\tif err := json.Unmarshal(rawCfg, &childConfig); err != nil {\n\t\t\treturn \"\", nil, fmt.Errorf(\"rls: json unmarshal failed for child policy config %q: %v\", string(rawCfg), err)\n\t\t}\n\t\tchildConfig[targetFieldName], _ = json.Marshal(dummyChildPolicyTarget)\n\t\tjsonCfg, err := json.Marshal(childConfig)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, fmt.Errorf(\"rls: json marshal failed for child policy config {%+v}: %v\", childConfig, err)\n\t\t}\n\t\tif _, err := parser.ParseConfig(jsonCfg); err != nil {\n\t\t\treturn \"\", nil, fmt.Errorf(\"rls: childPolicy config validation failed: %v\", err)\n\t\t}\n\t\treturn name, childConfig, nil\n\t}\n\treturn \"\", nil, fmt.Errorf(\"rls: invalid childPolicy config: no supported policies found in %+v\", childPolicies)\n}\n\nfunc convertDuration(d *durationpb.Duration) (time.Duration, error) {\n\tif d == nil {\n\t\treturn 0, nil\n\t}\n\treturn d.AsDuration(), d.CheckValid()\n}\n","sourceCodeStart":304,"sourceCodeEnd":331,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/balancer/rls/config.go#L304-L331","documentation":"Emitted from parseChildPolicyConfigs (config.go:322) after iterating every childPolicy entry without finding one whose name is a registered balancer (balancer.Get returns non-nil). Unregistered names are skipped silently during iteration; the error fires only if none of the listed policies are registered in this binary.","triggerScenarios":"Every policy name in the childPolicy array is either misspelled or refers to a balancer whose package is not linked into the binary. balancer.Get returns nil for each, so the loop completes without selecting one.","commonSituations":"Typo in policy name (e.g. 'roundrobin' instead of 'round_robin', 'grpclb' on a build without grpclb); using xDS child policies (cds, xds_cluster_resolver) in a non-xDS binary that does not import them; a custom LB not blank-imported; relying on an LB registered by a plugin that is disabled in this build.","solutions":["Use a definitely-registered policy such as 'round_robin' or 'pick_first' (imported via the core grpc module).","Blank-import the package providing the desired child policy, e.g. _ 'google.golang.org/grpc/balancer/roundrobin' or the xds module for cds/xds_cluster_resolver.","Check the spelling against balancer.Get(name) in a tiny test program; nil means not registered.","If multiple candidates are listed, ensure at least one is registered; ordering only affects which one wins, not whether this error fires."],"exampleFix":"// before: misspelled / unregistered policy\n\"childPolicy\": [ { \"roundrobin\": {} } ]\n\n// after\n\"childPolicy\": [ { \"round_robin\": {} } ]\n// and if needed in the binary:\nimport _ \"google.golang.org/grpc/balancer/roundrobin\"","handlingStrategy":"validation","validationCode":"func anyChildPolicyRegistered(policies []map[string]json.RawMessage) error {\n    found := false\n    for _, e := range policies {\n        for name := range e {\n            if balancer.Get(name) != nil {\n                found = true\n            }\n        }\n    }\n    if !found {\n        return errors.New(\"no registered balancer found among childPolicy entries\")\n    }\n    return nil\n}","typeGuard":"func childPolicyIsRegistered(name string) bool { return balancer.Get(name) != nil }","tryCatchPattern":null,"preventionTips":["Blank-import the balancer packages you reference (e.g. _ 'google.golang.org/grpc/balancer/roundrobin').","Use canonical policy names ('round_robin', 'pick_first').","Add a startup self-test that calls balancer.Get for each listed child policy."],"tags":["rls","child-policy","balancer","registration","validation"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}