{"record":{"id":"316bd5c908cbfedc","repo":"grpc/grpc-go","slug":"failed-to-create-child-policy-of-type-s-v","errorCode":null,"errorMessage":"failed to create child policy of type %s: %v","messagePattern":"failed to create child policy of type (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/cdsbalancer/cdsbalancer.go","lineNumber":273,"sourceCode":"\tif err := json.Unmarshal(clusterConfig.Cluster.LBPolicy, &b.xdsLBPolicy); err != nil {\n\t\treturn b.annotateErrorWithNodeID(fmt.Errorf(\"error unmarshalling xDS LB Policy: %v\", err))\n\t}\n\tif err := b.updateChildConfig(); err != nil {\n\t\treturn b.annotateErrorWithNodeID(err)\n\t}\n\treturn nil\n}\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 {","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/balancer/cdsbalancer/cdsbalancer.go#L255-L291","documentation":"The CDS balancer creates a child balancer (of type priority) when none exists, via newChildBalancer(). This error wraps any failure from that creation. The priority balancer is a core gRPC balancer that manages failover across priority levels within a cluster.","triggerScenarios":"Triggered in updateChildConfig() when b.childLB is nil and newChildBalancer(b.cc, b.bOpts) returns an error. The child balancer is always a priority balancer; failure would come from the priority balancer's Build() method.","commonSituations":"The priority balancer is not registered in the balancer registry (very unlikely in standard builds); a custom build that excludes or overrides core balancer registration; a nil ClientConn or broken BuildOptions passed internally (indicates a gRPC internal bug).","solutions":["This error indicates an internal gRPC issue — ensure you are using a stable grpc-go release, not a custom build that might exclude the priority balancer","If using a custom balancer registration mechanism, verify the priority balancer (\"priority_experimental\") is registered","Report as a bug if it occurs on a standard grpc-go build with no custom balancer modifications","Check for memory or resource exhaustion that might cause balancer.Build() to fail"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// No pre-validation possible — this is an internal balancer creation error\n// Ensure the priority balancer is registered by checking the registry","typeGuard":null,"tryCatchPattern":"// The channel enters TRANSIENT_FAILURE; monitor connectivity state\nif conn.GetState() == connectivity.TransientFailure {\n    // this is an internal error; report to grpc-go maintainers\n}","preventionTips":["Use standard grpc-go builds without stripping balancer registrations","Keep grpc-go up to date","Monitor channel connectivity states and alert on persistent TRANSIENT_FAILURE","Report internal balancer creation errors as bugs"],"tags":["xds","cds","priority","balancer","internal"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}