grpc/grpc-go · error
failed to build priority config
Error message
failed to build priority config: %v
What it means
Returned by buildPriorityConfigJSON (configbuilder.go:99) when buildPriorityConfig (line 108) returns an error. buildPriorityConfig iterates over priorities and for each EDS cluster calls buildClusterImplConfigForEDS (line 117), and for each DNS cluster calls buildClusterImplConfigForDNS (line 133). The EDS path can return an error from priorityLocalitiesToClusterImpl (line 222) if locality/endpoint processing fails.
Solutions
- Inspect the wrapped %v to find the specific failure in the priority config builder.
- Examine the cluster's locality and endpoint data for edge cases (zero localities, unusual weights).
- Check if a newer grpc-go version added validation that your data triggers.
- Report with cluster resource details to grpc-go maintainers if the data appears valid.
Defensive patterns
Strategy: try-catch
Try / catch
// Internal config builder error; surfaces as TRANSIENT_FAILURE.
// Unwrap for diagnostics:
err := getChannelError(conn)
if err != nil && strings.Contains(err.Error(), "failed to build priority config") {
inner := errors.Unwrap(err)
log.Printf("priority config build inner error: %v", inner)
// inspect cluster locality/endpoint data
} Prevention
- Keep grpc-go updated to benefit from bug fixes in the config builder.
- Validate cluster resources on the management server before deployment.
- Log full cluster resource details when debugging xDS issues.
When it happens
Trigger: During child config construction for a CDS cluster, buildClusterImplConfigForEDS calls priorityLocalitiesToClusterImpl which processes localities and endpoints. If this function returns an error (currently it always returns nil error in the read code, but the signature allows it), the error propagates through buildPriorityConfig to buildPriorityConfigJSON and then to updateChildConfig as error 349.
Common situations: An unexpected error in locality-to-cluster_impl conversion. Since the current priorityLocalitiesToClusterImpl does not return errors for any known condition, this error path is a safety net. If it does fire, it likely indicates a code path added in a future version or a modification.
Related errors
- failed to build child policy config
- failed to create child policy of type
- failed to marshal built priority config struct into json
- failed to parse child policy config. This should never…
- failed to push config to child policy
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/5d91b202ee6a3520.
Report an issue: GitHub.
Appendix: source
Thrown at internal/xds/balancer/cdsbalancer/configbuilder.go:99
// priorities.
//
// The built tree of balancers (see test for the output struct).
//
// ┌────────┐
// │priority│
// └┬──────┬┘
// │ │
// ┌──────────▼─┐ ┌─▼──────────┐
// │cluster_impl│ │cluster_impl│
// └──────┬─────┘ └─────┬──────┘
// │ │
// ┌──────▼─────┐ ┌─────▼──────┐
// │xDSLBPolicy │ │xDSLBPolicy │ (Locality and Endpoint picking layer)
// └────────────┘ └────────────┘
func buildPriorityConfigJSON(priorities []*priorityConfig, xdsLBPolicy *internalserviceconfig.BalancerConfig) ([]byte, []resolver.Endpoint, error) {
pc, endpoints, err := buildPriorityConfig(priorities, xdsLBPolicy)
if err != nil {
return nil, nil, fmt.Errorf("failed to build priority config: %v", err)
}
ret, err := json.Marshal(pc)
if err != nil {
return nil, nil, fmt.Errorf("failed to marshal built priority config struct into json: %v", err)
}
return ret, endpoints, nil
}
func buildPriorityConfig(priorities []*priorityConfig, xdsLBPolicy *internalserviceconfig.BalancerConfig) (*priority.LBConfig, []resolver.Endpoint, error) {
var (
retConfig = &priority.LBConfig{Children: make(map[string]*priority.Child)}
retEndpoints []resolver.Endpoint
)
for _, p := range priorities {
clusterUpdate := p.clusterConfig.Cluster
switch clusterUpdate.ClusterType {
case xdsresource.ClusterTypeEDS:
names, configs, endpoints, err := buildClusterImplConfigForEDS(p.childNameGen, p.clusterConfig, xdsLBPolicy)View on GitHub (pinned to 0c51461d27)