{"record":{"id":"6e234f43b75218d7","repo":"grpc/grpc-go","slug":"failed-to-parse-child-policy-config-this-should-n","errorCode":null,"errorMessage":"failed to parse child policy config. This should never happen because the config was generated: %v","messagePattern":"failed to parse child policy config\\. This should never happen because the config was generated: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/cdsbalancer/cdsbalancer.go","lineNumber":284,"sourceCode":"//\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\n\t\t}\n\t}\n\tif err := b.childLB.UpdateClientConnState(balancer.ClientConnState{\n\t\tResolverState: resolver.State{","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/balancer/cdsbalancer/cdsbalancer.go#L266-L302","documentation":"Returned by updateChildConfig (line 284) when b.childConfigParser.ParseConfig(childCfgBytes) fails on JSON that was just generated internally by buildPriorityConfigJSON. The message explicitly states 'This should never happen because the config was generated' — it is an internal invariant violation. The child config parser is the priority balancer's ParseConfig, and the input is JSON marshalled from a priority.LBConfig struct, so a parse failure indicates a structural mismatch between the generator and the parser.","triggerScenarios":"buildPriorityConfigJSON produces a priority.LBConfig, marshals it to JSON (line 101), and the priority balancer's ParseConfig (line 282) fails to unmarshal that same JSON. This can only happen if the priority.LBConfig struct and the priority balancer's expected JSON schema have diverged — a code-level inconsistency.","commonSituations":"Version skew where the cdsbalancer and priority packages are from different grpc-go versions. A code regression that changed the LBConfig struct fields without updating the priority parser (or vice versa). Mixing internal packages from different releases.","solutions":["Run 'go mod tidy' and ensure all google.golang.org/grpc internal packages come from the exact same module version.","Check 'go list -m all | grep grpc' for any replace directives or version mismatches.","Report as a bug to grpc-go if versions are consistent — this is an internal invariant the maintainers need to fix.","As a workaround, downgrade or upgrade to a known-good grpc-go release."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Internal invariant violation — not catchable by user code.\n// Report to grpc-go with full cluster resource and grpc-go version.\n// Check module version consistency as a first step:\n// go list -m all | grep 'google.golang.org/grpc'","preventionTips":["Ensure all grpc-go internal packages come from the same module version.","Avoid replace directives that mix grpc-go versions.","Pin the grpc-go version in go.mod to a known-good release."],"tags":["xds","internal-invariant","config","priority","version-skew"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}