grpc/grpc-go · error
xds_wrr_locality: config generated %v is invalid: %v
Error message
xds_wrr_locality: config generated %v is invalid: %v
What it means
Returned by wrr_locality UpdateClientConnState (internal/xds/balancer/wrrlocality/balancer.go:182) when the weighted-target config it generated from the endpoints/weights fails to parse via the child parser. This is an internal invariant violation — the generated config should always be valid — so it generally indicates a bug or an endpoint with an invalid locality string.
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 03255a9237)
Solutions
- Inspect the underlying error (%v) to see which target/weight the child parser rejected
- Verify endpoint locality weights are sane non-zero values
- Report it upstream if it reproduces with a valid xDS resolver state
Defensive patterns
Strategy: try-catch
Try / catch
if err := bal.UpdateClientConnState(state); err != nil {
if strings.Contains(err.Error(), "config generated") {
logger.Errorf("internal wrr_locality invariant violated; report upstream: %v", err)
}
return err
} Prevention
- Treat this as a bug — collect the endpoint set and weights and report it
- Keep wrrlocality and weightedtarget versions in sync
When it happens
Trigger: UpdateClientConnState builds weightedTargets from endpoints, marshals it to JSON, and the weighted_target parser rejects it. Only reachable if a generated weight/target combination is invalid.
Common situations: A zero or overflowing locality weight; an internal version mismatch between wrrlocality and weightedtarget; effectively never seen in production — treat as a bug report candidate.
Related errors
- xds_wrr_locality: invalid LBConfig: %s, error: %v
- xds_wrr_locality: missing locality weight information in end
- ringhash: expected xDS config selector to set the request ha
- OutlierDetectionLoadBalancingConfig.interval = %s; must be >
- OutlierDetectionLoadBalancingConfig.base_ejection_time = %s;
AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07).
Data as JSON: /api/errors/50525c786926ac6f.
Report an issue: GitHub.