grpc/grpc-go · error

LB policy name found in Priorities field ( ) is not found…

Error message

LB policy name %q found in Priorities field (%v) is not found in Children field (%+v)

What it means

priority's parseConfig cross-checks every name in the Priorities list against the Children map (config.go:55-58). A name present in Priorities but absent from Children is an inconsistent config and is rejected during ParseConfig, before any balancer is built.

Solutions

  1. Ensure every entry in Priorities has a matching key in Children.
  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 Priorities and Children for quick comparison.

Example fix

// before
{
  "children": {"child-A": {"config": {...}}},
  "priorities": ["child-A", "child-B"]
}
// after
{
  "children": {"child-A": {"config": {...}}, "child-B": {"config": {...}}},
  "priorities": ["child-A", "child-B"]
}
Defensive patterns

Strategy: validation

Validate before calling

func validatePrioritiesReferencedInChildren(cfg *priority.LBConfig) error {
    for _, p := range cfg.Priorities {
        if _, ok := cfg.Children[p]; !ok {
            return fmt.Errorf("priority %q is not in Children", p)
        }
    }
    return nil
}

Prevention

When it happens

Trigger: cfg.Priorities contains a name that is not a key in cfg.Children (e.g. priorities: ["child-A", "child-B"] but children only has "child-A").

Common situations: Manual priority config construction with mismatched fields; xDS resource with priority order referencing an undefined child; refactoring that renames a child in one field but not the other.

Related errors


AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11). Data as JSON: /api/errors/e05f8b03b9363db3. Report an issue: GitHub.

Appendix: source

Thrown at internal/xds/balancer/priority/config.go:57

	// Children is a map from the child balancer names to their configs. Child
	// names can be found in field Priorities.
	Children map[string]*Child `json:"children,omitempty"`
	// Priorities is a list of child balancer names. They are sorted from
	// highest priority to low. The type/config for each child can be found in
	// field Children, with the balancer name as the key.
	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)