{"record":{"id":"5d91b202ee6a3520","repo":"grpc/grpc-go","slug":"failed-to-build-priority-config-v","errorCode":null,"errorMessage":"failed to build priority config: %v","messagePattern":"failed to build priority config: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/cdsbalancer/configbuilder.go","lineNumber":99,"sourceCode":"// priorities.\n//\n// The built tree of balancers (see test for the output struct).\n//\n//\t          ┌────────┐\n//\t          │priority│\n//\t          └┬──────┬┘\n//\t           │      │\n//\t┌──────────▼─┐  ┌─▼──────────┐\n//\t│cluster_impl│  │cluster_impl│\n//\t└──────┬─────┘  └─────┬──────┘\n//\t       │              │\n//\t┌──────▼─────┐  ┌─────▼──────┐\n//\t│xDSLBPolicy │  │xDSLBPolicy │ (Locality and Endpoint picking layer)\n//\t└────────────┘  └────────────┘\nfunc buildPriorityConfigJSON(priorities []*priorityConfig, xdsLBPolicy *internalserviceconfig.BalancerConfig) ([]byte, []resolver.Endpoint, error) {\n\tpc, endpoints, err := buildPriorityConfig(priorities, xdsLBPolicy)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to build priority config: %v\", err)\n\t}\n\tret, err := json.Marshal(pc)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to marshal built priority config struct into json: %v\", err)\n\t}\n\treturn ret, endpoints, nil\n}\n\nfunc buildPriorityConfig(priorities []*priorityConfig, xdsLBPolicy *internalserviceconfig.BalancerConfig) (*priority.LBConfig, []resolver.Endpoint, error) {\n\tvar (\n\t\tretConfig    = &priority.LBConfig{Children: make(map[string]*priority.Child)}\n\t\tretEndpoints []resolver.Endpoint\n\t)\n\tfor _, p := range priorities {\n\t\tclusterUpdate := p.clusterConfig.Cluster\n\t\tswitch clusterUpdate.ClusterType {\n\t\tcase xdsresource.ClusterTypeEDS:\n\t\t\tnames, configs, endpoints, err := buildClusterImplConfigForEDS(p.childNameGen, p.clusterConfig, xdsLBPolicy)","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/balancer/cdsbalancer/configbuilder.go#L81-L117","documentation":"The buildPriorityConfigJSON function calls buildPriorityConfig to construct the priority/cluster_impl/xds-lb-policy balancer tree from the xDS cluster resources. This error wraps any failure from building that tree. Failures can come from building cluster_impl configs for EDS or LogicalDNS clusters, or assembling aggregate cluster configurations.","triggerScenarios":"Triggered in configbuilder.go when buildPriorityConfig(priorities, xdsLBPolicy) returns an error. The function iterates over priority configs, each representing a cluster, and builds cluster_impl child configs. Errors arise from buildClusterImplConfigForEDS, buildClusterImplConfigForLogicalDNS, or the outlier detection config conversion step.","commonSituations":"A cluster resource has a nil or missing required field that the config builder expects; the cluster type is not recognized by the switch statement in buildPriorityConfig; the xDS LB policy has an unexpected structure that causes config building to fail; outlier detection config conversion fails for a specific cluster.","solutions":["Enable GRPC_GO_LOG_SEVERITY=info to see the wrapped error with the specific failing cluster and field","Verify the cluster resources from the management server are complete and well-formed","Check that the xDS LB policy structure matches what the current grpc-go version expects","Report as a bug with the cluster resource details if the error occurs on standard configurations"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// No direct pre-validation — verify cluster resources are complete\n// via xDS management server APIs before deploying service configs","typeGuard":null,"tryCatchPattern":"// Monitor channel for TRANSIENT_FAILURE after config updates\nif conn.GetState() == connectivity.TransientFailure {\n    // check logs for 'failed to build priority config' with wrapped error\n}","preventionTips":["Validate cluster resources for supported types and complete fields","Test xDS configurations in staging environments","Keep grpc-go version current for cluster config builder compatibility","Monitor xDS processing logs for config building errors"],"tags":["xds","cds","config-builder","priority","cluster-impl"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}