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 AdvancedCircuitBreaker syntax when failureThreshold exceeds 1. failureThreshold is a ratio, so >1 (>100% failures) is invalid. Fires at policy build time.
Source
Thrown at src/Polly/CircuitBreaker/AsyncAdvancedCircuitBreakerSyntax.cs:236
public static AsyncCircuitBreakerPolicy AdvancedCircuitBreakerAsync(
this PolicyBuilder policyBuilder,
double failureThreshold,
TimeSpan samplingDuration,
int minimumThroughput,
TimeSpan durationOfBreak,
Action<Exception, 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 ratio in (0,1]; divide percentages by 100.
- Clamp the configured value into (0,1] at startup.
Example fix
// before .AdvancedCircuitBreakerAsync(failureThreshold: 75, ...) // after .AdvancedCircuitBreakerAsync(failureThreshold: 0.75, ...)
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 percentage config to a ratio at the binding boundary.
- Add an assertion test that construction succeeds with 1.0 and fails above it.
- Keep one validation helper shared across sync/async/generic overloads.
When it happens
Trigger: Calling AdvancedCircuitBreakerAsync(failureThreshold: 100, ...) expecting percent semantics. The check is `failureThreshold > 1`.
Common situations: Passing a percentage integer (50, 100) instead of a fraction (0.5, 1.0).
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/d1b9b9c3b0524e12.
Report an issue: GitHub.