{"record":{"id":"0651a9a1232535fd","repo":"grpc/grpc-go","slug":"outlierdetectionloadbalancingconfig-max-ejection-p","errorCode":null,"errorMessage":"OutlierDetectionLoadBalancingConfig.max_ejection_percent = %v; must be <= 100","messagePattern":"OutlierDetectionLoadBalancingConfig\\.max_ejection_percent = (.+?); must be <= 100","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/outlierdetection/balancer.go","lineNumber":143,"sourceCode":"\t// google.protobuf.Duration documentation and they must have non-negative\n\t// values.\" - A50\n\t// Approximately 290 years is the maximum time that time.Duration (int64)\n\t// can represent. The restrictions on the protobuf.Duration field are to be\n\t// within +-10000 years. Thus, just check for negative values.\n\tcase lbCfg.Interval < 0:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.interval = %s; must be >= 0\", lbCfg.Interval)\n\tcase lbCfg.BaseEjectionTime < 0:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.base_ejection_time = %s; must be >= 0\", lbCfg.BaseEjectionTime)\n\tcase lbCfg.MaxEjectionTime < 0:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.max_ejection_time = %s; must be >= 0\", lbCfg.MaxEjectionTime)\n\n\t// \"The fields max_ejection_percent,\n\t// success_rate_ejection.enforcement_percentage,\n\t// failure_percentage_ejection.threshold, and\n\t// failure_percentage.enforcement_percentage must have values less than or\n\t// equal to 100.\" - A50\n\tcase lbCfg.MaxEjectionPercent > 100:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.max_ejection_percent = %v; must be <= 100\", lbCfg.MaxEjectionPercent)\n\tcase lbCfg.SuccessRateEjection != nil && lbCfg.SuccessRateEjection.EnforcementPercentage > 100:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.SuccessRateEjection.enforcement_percentage = %v; must be <= 100\", lbCfg.SuccessRateEjection.EnforcementPercentage)\n\tcase lbCfg.FailurePercentageEjection != nil && lbCfg.FailurePercentageEjection.Threshold > 100:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.FailurePercentageEjection.threshold = %v; must be <= 100\", lbCfg.FailurePercentageEjection.Threshold)\n\tcase lbCfg.FailurePercentageEjection != nil && lbCfg.FailurePercentageEjection.EnforcementPercentage > 100:\n\t\treturn nil, fmt.Errorf(\"OutlierDetectionLoadBalancingConfig.FailurePercentageEjection.enforcement_percentage = %v; must be <= 100\", lbCfg.FailurePercentageEjection.EnforcementPercentage)\n\t}\n\treturn lbCfg, nil\n}\n\nfunc (bb) Name() string {\n\treturn Name\n}\n\n// scUpdate wraps a subConn update to be sent to the child balancer.\ntype scUpdate struct {\n\tscw   *subConnWrapper\n\tstate balancer.SubConnState","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/balancer/outlierdetection/balancer.go#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set `max_ejection_percent` to a value between 0 and 100 inclusive (omit for the 10 default)","Fix the xDS OutlierDetection resource","Range-check percentage fields in your config emitter"],"exampleFix":"// before\n{\"maxEjectionPercent\":150}\n// after\n{\"maxEjectionPercent\":10}","handlingStrategy":"validation","validationCode":"var probe struct{ MaxEjectionPercent uint32 `json:\"max_ejection_percent\"` }\n_ = json.Unmarshal(raw, &probe)\nif probe.MaxEjectionPercent > 100 {\n    return fmt.Errorf(\"max_ejection_percent must be <= 100, got %d\", probe.MaxEjectionPercent)\n}","typeGuard":null,"tryCatchPattern":"lbCfg, err := outlierBB.ParseConfig(raw)\nif err != nil {\n    logger.Warningf(\"rejecting outlier detection config: %v\", err)\n    return fallbackLBConfig\n}","preventionTips":["Range-check every percentage field to 0-100 before publishing","Use a single helper for percent validation across the config emitter"],"tags":["grpc","xds","outlier-detection","load-balancing","config","go"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}