grpc/grpc-go · error

OutlierDetectionLoadBalancingConfig.max_ejection_percent = %

Error message

OutlierDetectionLoadBalancingConfig.max_ejection_percent = %v; must be <= 100

What it means

Returned by outlier detection ParseConfig (internal/xds/balancer/outlierdetection/balancer.go:142) when `max_ejection_percent` exceeds 100. gRFC A50 requires this field (and several other percentage fields) to be <= 100; the default is 10. It bounds the fraction of endpoints that may be ejected at once.

Source

Thrown at internal/xds/balancer/outlierdetection/balancer.go:143

	// google.protobuf.Duration documentation and they must have non-negative
	// values." - A50
	// Approximately 290 years is the maximum time that time.Duration (int64)
	// can represent. The restrictions on the protobuf.Duration field are to be
	// within +-10000 years. Thus, just check for negative values.
	case lbCfg.Interval < 0:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.interval = %s; must be >= 0", lbCfg.Interval)
	case lbCfg.BaseEjectionTime < 0:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.base_ejection_time = %s; must be >= 0", lbCfg.BaseEjectionTime)
	case lbCfg.MaxEjectionTime < 0:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.max_ejection_time = %s; must be >= 0", lbCfg.MaxEjectionTime)

	// "The fields max_ejection_percent,
	// success_rate_ejection.enforcement_percentage,
	// failure_percentage_ejection.threshold, and
	// failure_percentage.enforcement_percentage must have values less than or
	// equal to 100." - A50
	case lbCfg.MaxEjectionPercent > 100:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.max_ejection_percent = %v; must be <= 100", lbCfg.MaxEjectionPercent)
	case lbCfg.SuccessRateEjection != nil && lbCfg.SuccessRateEjection.EnforcementPercentage > 100:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.SuccessRateEjection.enforcement_percentage = %v; must be <= 100", lbCfg.SuccessRateEjection.EnforcementPercentage)
	case lbCfg.FailurePercentageEjection != nil && lbCfg.FailurePercentageEjection.Threshold > 100:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.FailurePercentageEjection.threshold = %v; must be <= 100", lbCfg.FailurePercentageEjection.Threshold)
	case lbCfg.FailurePercentageEjection != nil && lbCfg.FailurePercentageEjection.EnforcementPercentage > 100:
		return nil, fmt.Errorf("OutlierDetectionLoadBalancingConfig.FailurePercentageEjection.enforcement_percentage = %v; must be <= 100", lbCfg.FailurePercentageEjection.EnforcementPercentage)
	}
	return lbCfg, nil
}

func (bb) Name() string {
	return Name
}

// scUpdate wraps a subConn update to be sent to the child balancer.
type scUpdate struct {
	scw   *subConnWrapper
	state balancer.SubConnState

View on GitHub (pinned to 03255a9237)

Solutions

  1. Set `max_ejection_percent` to a value between 0 and 100 inclusive (omit for the 10 default)
  2. Fix the xDS OutlierDetection resource
  3. Range-check percentage fields in your config emitter

Example fix

// before
{"maxEjectionPercent":150}
// after
{"maxEjectionPercent":10}
Defensive patterns

Strategy: validation

Validate before calling

var probe struct{ MaxEjectionPercent uint32 `json:"max_ejection_percent"` }
_ = json.Unmarshal(raw, &probe)
if probe.MaxEjectionPercent > 100 {
    return fmt.Errorf("max_ejection_percent must be <= 100, got %d", probe.MaxEjectionPercent)
}

Try / catch

lbCfg, err := outlierBB.ParseConfig(raw)
if err != nil {
    logger.Warningf("rejecting outlier detection config: %v", err)
    return fallbackLBConfig
}

Prevention

When it happens

Trigger: ParseConfig receives JSON where `max_ejection_percent` is an integer greater than 100. Produced by a control plane or hand-built config setting an out-of-range percentage.

Common situations: Operator sets max_ejection_percent to a value like 150 expecting it to mean 'always allow'; control-plane validation gap; copy-paste from a config that used a different scale.

Related errors


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