grpc/grpc-go · error
LB policy name found in Children field ( ) is not found in…
Error message
LB policy name %q found in Children field (%v) is not found in Priorities field (%+v)
What it means
priority's parseConfig also verifies every child in Children is referenced by Priorities (config.go:61-64). An orphan child defined in Children but not listed in Priorities is rejected during ParseConfig, since priority would never be able to use it.
Solutions
- Ensure every key in Children appears exactly once in Priorities.
- Generate the config from a single source of truth so the two fields cannot drift.
- Inspect the full error message: it prints both Children and Priorities for quick comparison.
Example fix
// before
{
"children": {"child-A": {...}, "child-B": {...}},
"priorities": ["child-A"]
}
// after
{
"children": {"child-A": {...}, "child-B": {...}},
"priorities": ["child-A", "child-B"]
} Defensive patterns
Strategy: validation
Validate before calling
func validateChildrenReferencedInPriorities(cfg *priority.LBConfig) error {
inPriorities := make(map[string]bool, len(cfg.Priorities))
for _, p := range cfg.Priorities { inPriorities[p] = true }
for name := range cfg.Children {
if !inPriorities[name] {
return fmt.Errorf("child %q is not in Priorities", name)
}
}
return nil
} Prevention
- Generate Priorities as the ordered list of every Children map key.
- Add a unit test that asserts every Children entry is referenced by Priorities.
- Inspect the full error message which prints both fields for quick diffing.
When it happens
Trigger: cfg.Children has a key that is not present in cfg.Priorities (e.g. children: {"child-A": ..., "child-B": ...} but priorities only lists "child-A").
Common situations: Manual priority config construction with mismatched fields; xDS resource defining a child that the priority order omits; refactoring that removes a name from Priorities but leaves it in Children.
Related errors
- LB policy name found in Priorities field ( ) is not found…
- failed to push new configuration
- unexpected balancer config with type: %T
- xds_wrr_locality: config generated
- xds_wrr_locality: invalid LBConfig
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/6c4d3c6964f8aab8.
Report an issue: GitHub.
Appendix: source
Thrown at internal/xds/balancer/priority/config.go:63
Priorities []string `json:"priorities,omitempty"`
}
func parseConfig(c json.RawMessage) (*LBConfig, error) {
var cfg LBConfig
if err := json.Unmarshal(c, &cfg); err != nil {
return nil, err
}
prioritiesSet := make(map[string]bool)
for _, name := range cfg.Priorities {
if _, ok := cfg.Children[name]; !ok {
return nil, fmt.Errorf("LB policy name %q found in Priorities field (%v) is not found in Children field (%+v)", name, cfg.Priorities, cfg.Children)
}
prioritiesSet[name] = true
}
for name := range cfg.Children {
if _, ok := prioritiesSet[name]; !ok {
return nil, fmt.Errorf("LB policy name %q found in Children field (%v) is not found in Priorities field (%+v)", name, cfg.Children, cfg.Priorities)
}
}
return &cfg, nil
}
View on GitHub (pinned to 0c51461d27)