App-vNext/Polly · error · ArgumentOutOfRangeException
Value must be less than or equal to one.
Error message
Value must be less than or equal to one.
What it means
Thrown by the legacy v7 Polly AdvancedCircuitBreaker<T> syntax when failureThreshold exceeds 1. Since failureThreshold is a failure RATIO, a value above 1 (>100% failures) is invalid. Fires at policy construction time.
Source
Thrown at src/Polly/CircuitBreaker/AdvancedCircuitBreakerTResultSyntax.cs:233
this PolicyBuilder<TResult> policyBuilder,
double failureThreshold,
TimeSpan samplingDuration,
int minimumThroughput,
TimeSpan durationOfBreak,
Action<DelegateResult<TResult>, CircuitState, TimeSpan, Context> onBreak,
Action<Context> onReset,
Action onHalfOpen)
{
var resolutionOfCircuit = TimeSpan.FromTicks(AdvancedCircuitController<EmptyStruct>.ResolutionOfCircuitTimer);
if (failureThreshold <= 0)
{
throw new ArgumentOutOfRangeException(nameof(failureThreshold), "Value must be greater than zero.");
}
if (failureThreshold > 1)
{
throw new ArgumentOutOfRangeException(nameof(failureThreshold), "Value must be less than or equal to one.");
}
if (samplingDuration < resolutionOfCircuit)
{
throw new ArgumentOutOfRangeException(nameof(samplingDuration), $"Value must be equal to or greater than {resolutionOfCircuit.TotalMilliseconds} milliseconds. This is the minimum resolution of the CircuitBreaker timer.");
}
if (minimumThroughput <= 1)
{
throw new ArgumentOutOfRangeException(nameof(minimumThroughput), "Value must be greater than one.");
}
if (durationOfBreak < TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException(nameof(durationOfBreak), "Value must be greater than zero.");
}
if (onBreak == null)View on GitHub (pinned to d0e46bdb1e)
Solutions
- Divide a percentage by 100 before passing it: 50 -> 0.5.
- Clamp/validate the configured value to the (0,1] range at startup.
- Treat failureThreshold as a fraction, not a percent and not an absolute count.
Example fix
// before
.AdvancedCircuitBreaker(
failureThreshold: 50, // meant 50%
...)
// after
.AdvancedCircuitBreaker(
failureThreshold: 0.5,
...) Defensive patterns
Strategy: validation
Validate before calling
if (failureThreshold is <= 0 or > 1)
throw new ArgumentOutOfRangeException(nameof(failureThreshold), "failureThreshold must be in (0,1]."); Type guard
static bool IsValidFailureThreshold(double t) => t > 0 && t <= 1;
Prevention
- If your config is a percentage, divide by 100 in the binding step.
- Add a startup health check asserting failureThreshold is in (0,1].
- Document the parameter as a ratio at the call site.
When it happens
Trigger: Calling AdvancedCircuitBreaker(failureThreshold: 2, ...) or passing 50 expecting percent semantics. The check is `failureThreshold > 1`.
Common situations: Passing a percentage (e.g. 50 for 50%, or 100) instead of a ratio (0.5, 1.0). Misreading the parameter as a count rather than a ratio.
Related errors
- Value must be greater than zero.
- Value must be greater than one.
- Value must be greater than zero.
- Value must be less than or equal to one.
- Value must be greater than one.
AI-assisted analysis of App-vNext/Polly@d0e46bdb1e (2026-08-13).
Data as JSON: /api/errors/bb0fa9e894ae04e0.
Report an issue: GitHub.