{"record":{"id":"6106fa22375a584f","repo":"grpc/grpc-go","slug":"failed-to-build-child-policy-config-v","errorCode":null,"errorMessage":"failed to build child policy config: %v","messagePattern":"failed to build child policy config: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/cdsbalancer/cdsbalancer.go","lineNumber":280,"sourceCode":"}\n\n// updateChildConfig builds child policy configuration using endpoint addresses\n// returned from the XDSConfig and child policy configuration.\n//\n// A child policy is created if one doesn't already exist. The newly built\n// configuration is then pushed to the child policy.\nfunc (b *cdsBalancer) updateChildConfig() error {\n\tif b.childLB == nil {\n\t\tchildLB, err := newChildBalancer(b.cc, b.bOpts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create child policy of type %s: %v\", priority.Name, err)\n\t\t}\n\t\tb.childLB = childLB\n\t}\n\n\tchildCfgBytes, endpoints, err := buildPriorityConfigJSON(b.priorities, &b.xdsLBPolicy)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build child policy config: %v\", err)\n\t}\n\tchildCfg, err := b.childConfigParser.ParseConfig(childCfgBytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse child policy config. This should never happen because the config was generated: %v\", err)\n\t}\n\tif b.logger.V(2) {\n\t\tb.logger.Infof(\"Built child policy config: %s\", pretty.ToJSON(childCfg))\n\t}\n\n\tfor i := range endpoints {\n\t\tfor j := range endpoints[i].Addresses {\n\t\t\taddr := endpoints[i].Addresses[j]\n\t\t\taddr.BalancerAttributes = endpoints[i].Attributes\n\t\t\t// BalancerAttributes are used for the following:\n\t\t\t// * Authority Override.\n\t\t\t// * grpc.lb.backend_service metric label propagation.\n\t\t\t// See https://github.com/grpc/grpc-go/issues/6472\n\t\t\tendpoints[i].Addresses[j] = addr","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/balancer/cdsbalancer/cdsbalancer.go#L262-L298","documentation":"The CDS balancer calls buildPriorityConfigJSON() to construct the child policy configuration from priority configs and the xDS LB policy. This error wraps any failure from that function, which builds a tree of cluster_impl balancers under a priority balancer. The underlying error could come from building cluster_impl configs for EDS, LogicalDNS, or aggregate cluster types.","triggerScenarios":"Triggered in updateChildConfig() when buildPriorityConfigJSON(b.priorities, &b.xdsLBPolicy) returns an error. The function iterates over priorities, builds cluster_impl configs for each, and assembles them into a priority LB config structure. Failures come from buildClusterImplConfigForEDS, buildClusterImplConfigForLogicalDNS, or aggregate cluster handling.","commonSituations":"A cluster resource has an unsupported or unrecognized cluster type; internal struct building encounters a nil pointer or missing required field in the cluster config; aggregate cluster references leaf clusters with invalid configurations; the xDS LB policy struct is in an unexpected state.","solutions":["Enable GRPC_GO_LOG_SEVERITY=info to see the wrapped error from buildPriorityConfigJSON that reveals the specific failing cluster","Verify all cluster resources referenced by the CDS balancer have valid and supported cluster types (EDS, LogicalDNS, Aggregate)","Check for version compatibility between your grpc-go and the management server's resource format","Report as a bug with full logs if the error occurs on standard cluster configurations"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// No direct pre-validation — verify cluster resources are well-formed\n// via the xDS client debug APIs before relying on them","typeGuard":null,"tryCatchPattern":"// Monitor for TRANSIENT_FAILURE after xDS config updates\nif conn.GetState() == connectivity.TransientFailure {\n    // check logs for 'failed to build child policy config' with wrapped error\n}","preventionTips":["Validate cluster resources on the management server for supported cluster types","Keep grpc-go version current for cluster config building compatibility","Test xDS configurations in staging before production deployment","Monitor xDS resource processing logs for config building errors"],"tags":["xds","cds","priority","config","cluster-impl"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}