grpc/grpc-go · error
xds_wrr_locality: config generated
Error message
xds_wrr_locality: config generated %v is invalid: %v
What it means
Returned when the weighted-target child balancer's ConfigParser rejects the config that wrr_locality generated from locality weights and the configured child policy. The generated weighted target JSON is logged so you can see exactly what was rejected.
Solutions
- Read the nested child-parser error (the second %v) to identify which childPolicy failed.
- Ensure the named child balancer is registered: import the balancer package (e.g. _ "google.golang.org/grpc/balancer/weightedroundrobin") or use a built-in like round_robin.
- Correct the childPolicy entry in the xDS/LB config to a registered, correctly-shaped policy.
- Upgrade grpc-go if the policy is supported only in a newer version.
Example fix
// before: childPolicy references an unregistered balancer
{"childPolicy":[{"wrr":{}}]}
// after: use a registered balancer
{"childPolicy":[{"round_robin":{}}]} Defensive patterns
Strategy: validation
Validate before calling
// Confirm the childPolicy names a registered balancer before publishing config.
func childPolicyRegistered(name string) bool {
return balancer.Get(name) != nil
} Try / catch
// The nested child-parser error is wrapped; inspect it.
if err := b.UpdateClientConnState(s); err != nil {
if strings.Contains(err.Error(), "config generated") {
// pull the nested cause and fix the childPolicy block.
}
} Prevention
- Import side-effect packages for any non-default balancers you reference.
- Use canonical balancer names (round_robin, weighted_round_robin, pick_first).
- Test the service config against the running client before rolling out.
When it happens
Trigger: Triggered at balancer.go:182 when b.childParser.ParseConfig(wtCfgJSON) (the weighted_target parser) returns an error. Root cause is usually an invalid or unregistered childPolicy inside the wrr_locality LBConfig.
Common situations: The childPolicy named in the wrr_locality config is not a registered balancer (typo, e.g. 'wrr' instead of 'weighted_round_robin'); the child policy requires config fields that were not supplied; grpc-go version that does not register the requested policy.
Related errors
- xds_wrr_locality: invalid LBConfig
- failed to push new configuration
- LB policy name found in Children field ( ) is not found in…
- LB policy name found in Priorities field ( ) is not found…
- xds_wrr_locality: error marshalling prepared config
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/50525c786926ac6f.
Report an issue: GitHub.
Appendix: source
Thrown at internal/xds/balancer/wrrlocality/balancer.go:182
// shouldn't happen though (this attribute that is set actually gets
// used to build localities in the first place), and thus don't error
// out, and just build a weighted target with undefined behavior.
locality := xdsinternal.LocalityString(xdsinternal.LocalityIDFromEndpoint(ep))
ai, ok := getAddrInfo(ep)
if !ok {
return fmt.Errorf("xds_wrr_locality: missing locality weight information in endpoint %q", ep)
}
weightedTargets[locality] = weightedtarget.Target{Weight: ai.LocalityWeight, ChildPolicy: lbCfg.ChildPolicy}
}
wtCfg := &weightedtarget.LBConfig{Targets: weightedTargets}
wtCfgJSON, err := json.Marshal(wtCfg)
if err != nil {
// Shouldn't happen.
return fmt.Errorf("xds_wrr_locality: error marshalling prepared config: %v", wtCfg)
}
var sc serviceconfig.LoadBalancingConfig
if sc, err = b.childParser.ParseConfig(wtCfgJSON); err != nil {
return fmt.Errorf("xds_wrr_locality: config generated %v is invalid: %v", wtCfgJSON, err)
}
return b.child.UpdateClientConnState(balancer.ClientConnState{
ResolverState: s.ResolverState,
BalancerConfig: sc,
})
}
func (b *wrrLocalityBalancer) ResolverError(err error) {
b.child.ResolverError(err)
}
func (b *wrrLocalityBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
b.logger.Errorf("UpdateSubConnState(%v, %+v) called unexpectedly", sc, state)
}
func (b *wrrLocalityBalancer) Close() {
b.child.Close()View on GitHub (pinned to 0c51461d27)