{"record":{"id":"6c4d3c6964f8aab8","repo":"grpc/grpc-go","slug":"lb-policy-name-q-found-in-children-field-v-is","errorCode":null,"errorMessage":"LB policy name %q found in Children field (%v) is not found in Priorities field (%+v)","messagePattern":"LB policy name %q found in Children field \\((.+?)\\) is not found in Priorities field \\(%\\+v\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/priority/config.go","lineNumber":63,"sourceCode":"\tPriorities []string `json:\"priorities,omitempty\"`\n}\n\nfunc parseConfig(c json.RawMessage) (*LBConfig, error) {\n\tvar cfg LBConfig\n\tif err := json.Unmarshal(c, &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tprioritiesSet := make(map[string]bool)\n\tfor _, name := range cfg.Priorities {\n\t\tif _, ok := cfg.Children[name]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"LB policy name %q found in Priorities field (%v) is not found in Children field (%+v)\", name, cfg.Priorities, cfg.Children)\n\t\t}\n\t\tprioritiesSet[name] = true\n\t}\n\tfor name := range cfg.Children {\n\t\tif _, ok := prioritiesSet[name]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"LB policy name %q found in Children field (%v) is not found in Priorities field (%+v)\", name, cfg.Children, cfg.Priorities)\n\t\t}\n\t}\n\treturn &cfg, nil\n}\n","sourceCodeStart":45,"sourceCodeEnd":68,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/balancer/priority/config.go#L45-L68","documentation":"Returned by the priority balancer's parseConfig (internal/xds/balancer/priority/config.go:62) when a key exists in the `children` map but is not listed in the `priorities` array. Every defined child must appear in priorities; an orphaned child is rejected.","triggerScenarios":"parseConfig receives JSON where `children` defines a name that does not appear in `priorities` — e.g. children:{\"a\",\"b\"} but priorities:[\"a\"].","commonSituations":"Control plane adds a child but forgets to add it to priorities; typo in the priorities list; stale child left in the map after a priorities edit.","solutions":["Add every child name to the `priorities` list, or remove unused children","Correct the upstream xDS resource to keep children and priorities in sync","Validate that the children key set equals the priorities set before publishing"],"exampleFix":"// before\n{\"children\":{\"a\":{...},\"b\":{...}},\"priorities\":[\"a\"]}\n// after\n{\"children\":{\"a\":{...},\"b\":{...}},\"priorities\":[\"a\",\"b\"]}","handlingStrategy":"validation","validationCode":"var probe struct {\n    Children   map[string]json.RawMessage `json:\"children\"`\n    Priorities []string                   `json:\"priorities\"`\n}\n_ = json.Unmarshal(raw, &probe)\npset := make(map[string]bool, len(probe.Priorities))\nfor _, p := range probe.Priorities { pset[p] = true }\nfor name := range probe.Children {\n    if !pset[name] {\n        return fmt.Errorf(\"child %q is not listed in priorities\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":"cfg, err := priorityParseConfig(raw)\nif err != nil {\n    logger.Warningf(\"rejecting priority config: %v\", err)\n    return fallbackLBConfig\n}","preventionTips":["Keep the children map and priorities list in lockstep","Remove children when dropping them from priorities"],"tags":["grpc","xds","priority","load-balancing","config","go"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}