{"record":{"id":"8ebedf7bc970bfff","repo":"grpc/grpc-go","slug":"outlierdetectionloadbalancingconfig-failurepercent-8ebedf","errorCode":null,"errorMessage":"OutlierDetectionLoadBalancingConfig.FailurePercentageEjection.enforcement_percentage = %v; must be <= 100","messagePattern":"OutlierDetectionLoadBalancingConfig\\.FailurePercentageEjection\\.enforcement_percentage = (.+?); must be <= 100","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/outlierdetection/balancer.go","lineNumber":149,"sourceCode":"\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\n}\n\ntype ejectionUpdate struct {\n\tscw       *subConnWrapper\n\tisEjected bool // true for ejected, false for unejected\n}","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/balancer/outlierdetection/balancer.go#L131-L167","documentation":"Per gRFC A50, FailurePercentageEjection.enforcement_percentage must be <= 100. ParseConfig checks lbCfg.FailurePercentageEjection != nil && EnforcementPercentage > 100 (balancer.go:148-149) and rejects. The field controls the probability of enforcing a failure-percentage ejection.","triggerScenarios":"FailurePercentageEjection is set in the config and its EnforcementPercentage field exceeds 100.","commonSituations":"Manual config with enforcement_percentage > 100; typo; control plane misconfiguration.","solutions":["Set FailurePercentageEjection.EnforcementPercentage to a value in [0, 100].","Validate the percentage range before constructing the config."],"exampleFix":"// before\ncfg.FailurePercentageEjection.EnforcementPercentage = 150\n// after\ncfg.FailurePercentageEjection.EnforcementPercentage = 100","handlingStrategy":"validation","validationCode":"func validateFailurePercentageEnforcement(fpe *outlierdetection.FailurePercentageEjection) error {\n    if fpe != nil && fpe.EnforcementPercentage > 100 {\n        return fmt.Errorf(\"failure_percentage.enforcement_percentage must be <= 100, got %d\", fpe.EnforcementPercentage)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When setting FailurePercentageEjection, default EnforcementPercentage to a value <= 100 (A50 default 0).","Range-check the nested struct before assigning it to LBConfig.","Add a unit test that asserts nested percentages stay in range."],"tags":["go","grpc","xds","outlier-detection","validation","percentage"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}