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 async AdvancedCircuitBreakerAsync<T> syntax when failureThreshold exceeds 1. failureThreshold is a ratio in (0,1]; values above 1 are invalid (>100% failure rate). Fires at policy build time.
Source
Thrown at src/Polly/CircuitBreaker/AsyncAdvancedCircuitBreakerTResultSyntax.cs:226
/// <exception cref="ArgumentOutOfRangeException">failureThreshold;Value must be less than or equal to one.</exception>
/// <exception cref="ArgumentOutOfRangeException">samplingDuration;Value must be equal to or greater than the minimum resolution of the CircuitBreaker timer.</exception>
/// <exception cref="ArgumentOutOfRangeException">minimumThroughput;Value must be greater than one.</exception>
/// <exception cref="ArgumentOutOfRangeException">durationOfBreak;Value must be greater than zero.</exception>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="onBreak"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="onReset"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="onHalfOpen"/> is <see langword="null"/>.</exception>
public static AsyncCircuitBreakerPolicy<TResult> AdvancedCircuitBreakerAsync<TResult>(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
- Pass a fraction in (0,1]; divide percentages by 100.
- Clamp configured value to (0,1] at startup.
Example fix
// before .AdvancedCircuitBreakerAsync(failureThreshold: 100, ...) // after .AdvancedCircuitBreakerAsync(failureThreshold: 1.0, ...)
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
- Convert percentages to ratios at the config-binding boundary.
- Add a unit test that asserts 1.0 is the upper bound.
- Document failureThreshold as a fraction in your wrapper.
When it happens
Trigger: Calling AdvancedCircuitBreakerAsync(failureThreshold: 100, ...) treating the value as a percent. The check is `failureThreshold > 1`.
Common situations: Passing a percentage integer instead of a fraction.
Related errors
- Value must be greater than zero.
- Value must be greater than one.
- Value must be greater than zero.
- Value must be greater than zero.
- Value must be less than or equal to one.
AI-assisted analysis of App-vNext/Polly@d0e46bdb1e (2026-08-13).
Data as JSON: /api/errors/5007ea42cd8a2b53.
Report an issue: GitHub.