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

  1. Ensure every key in Children appears exactly once in Priorities.
  2. Generate the config from a single source of truth so the two fields cannot drift.
  3. 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

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


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)