{"record":{"id":"e05f8b03b9363db3","repo":"grpc/grpc-go","slug":"lb-policy-name-q-found-in-priorities-field-v-i","errorCode":null,"errorMessage":"LB policy name %q found in Priorities field (%v) is not found in Children field (%+v)","messagePattern":"LB policy name %q found in Priorities field \\((.+?)\\) is not found in Children field \\(%\\+v\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/priority/config.go","lineNumber":57,"sourceCode":"\t// Children is a map from the child balancer names to their configs. Child\n\t// names can be found in field Priorities.\n\tChildren map[string]*Child `json:\"children,omitempty\"`\n\t// Priorities is a list of child balancer names. They are sorted from\n\t// highest priority to low. The type/config for each child can be found in\n\t// field Children, with the balancer name as the key.\n\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":39,"sourceCodeEnd":68,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/balancer/priority/config.go#L39-L68","documentation":"Returned by the priority balancer's parseConfig (internal/xds/balancer/priority/config.go:56) when a name listed in the `priorities` array is not present as a key in the `children` map. The priority balancer requires every priority entry to have a matching child definition.","triggerScenarios":"parseConfig receives JSON where `priorities` references a child name that is absent from (or misspelled vs) the `children` map — e.g. priorities:[\"a\",\"b\"] but children only defines \"a\".","commonSituations":"Control plane emits a priority list and children map that drifted out of sync; typo in a child name between the two fields; partial config update that dropped a child.","solutions":["Make every entry in `priorities` have a matching key in `children`","Fix the upstream xDS resource so priorities and children stay consistent","Validate priority/children set equality before publishing the config"],"exampleFix":"// before\n{\"children\":{\"a\":{...}},\"priorities\":[\"a\",\"b\"]}\n// after\n{\"children\":{\"a\":{...},\"b\":{...}},\"priorities\":[\"a\",\"b\"]}","handlingStrategy":"validation","validationCode":"// Ensure every priority has a matching child before parse.\nvar probe struct {\n    Children   map[string]json.RawMessage `json:\"children\"`\n    Priorities []string                   `json:\"priorities\"`\n}\n_ = json.Unmarshal(raw, &probe)\nfor _, p := range probe.Priorities {\n    if _, ok := probe.Children[p]; !ok {\n        return fmt.Errorf(\"priority %q has no child definition\", p)\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":["Generate priorities and children from a single source of truth","Assert set equality of children keys and priorities in config tests"],"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"}