grpc/grpc-go · error

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

Error message

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

What it means

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.

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 03255a9237)

Solutions

  1. Make every entry in `priorities` have a matching key in `children`
  2. Fix the upstream xDS resource so priorities and children stay consistent
  3. Validate priority/children set equality before publishing the config

Example fix

// before
{"children":{"a":{...}},"priorities":["a","b"]}
// after
{"children":{"a":{...},"b":{...}},"priorities":["a","b"]}
Defensive patterns

Strategy: validation

Validate before calling

// Ensure every priority has a matching child before parse.
var probe struct {
    Children   map[string]json.RawMessage `json:"children"`
    Priorities []string                   `json:"priorities"`
}
_ = json.Unmarshal(raw, &probe)
for _, p := range probe.Priorities {
    if _, ok := probe.Children[p]; !ok {
        return fmt.Errorf("priority %q has no child definition", p)
    }
}

Try / catch

cfg, err := priorityParseConfig(raw)
if err != nil {
    logger.Warningf("rejecting priority config: %v", err)
    return fallbackLBConfig
}

Prevention

When it happens

Trigger: 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".

Common situations: 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.

Related errors


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