{"record":{"id":"bb0fa9e894ae04e0","repo":"App-vNext/Polly","slug":"value-must-be-less-than-or-equal-to-one-bb0fa9","errorCode":null,"errorMessage":"Value must be less than or equal to one.","messagePattern":"Value must be less than or equal to one\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Polly/CircuitBreaker/AdvancedCircuitBreakerTResultSyntax.cs","lineNumber":233,"sourceCode":"        this PolicyBuilder<TResult> policyBuilder,\n        double failureThreshold,\n        TimeSpan samplingDuration,\n        int minimumThroughput,\n        TimeSpan durationOfBreak,\n        Action<DelegateResult<TResult>, CircuitState, TimeSpan, Context> onBreak,\n        Action<Context> onReset,\n        Action onHalfOpen)\n    {\n        var resolutionOfCircuit = TimeSpan.FromTicks(AdvancedCircuitController<EmptyStruct>.ResolutionOfCircuitTimer);\n\n        if (failureThreshold <= 0)\n        {\n            throw new ArgumentOutOfRangeException(nameof(failureThreshold), \"Value must be greater than zero.\");\n        }\n\n        if (failureThreshold > 1)\n        {\n            throw new ArgumentOutOfRangeException(nameof(failureThreshold), \"Value must be less than or equal to one.\");\n        }\n\n        if (samplingDuration < resolutionOfCircuit)\n        {\n            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.\");\n        }\n\n        if (minimumThroughput <= 1)\n        {\n            throw new ArgumentOutOfRangeException(nameof(minimumThroughput), \"Value must be greater than one.\");\n        }\n\n        if (durationOfBreak < TimeSpan.Zero)\n        {\n            throw new ArgumentOutOfRangeException(nameof(durationOfBreak), \"Value must be greater than zero.\");\n        }\n\n        if (onBreak == null)","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/App-vNext/Polly/blob/d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac/src/Polly/CircuitBreaker/AdvancedCircuitBreakerTResultSyntax.cs#L215-L251","documentation":"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.","triggerScenarios":"Calling AdvancedCircuitBreaker(failureThreshold: 2, ...) or passing 50 expecting percent semantics. The check is `failureThreshold > 1`.","commonSituations":"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.","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."],"exampleFix":"// before\n.AdvancedCircuitBreaker(\n    failureThreshold: 50, // meant 50%\n    ...)\n\n// after\n.AdvancedCircuitBreaker(\n    failureThreshold: 0.5,\n    ...)","handlingStrategy":"validation","validationCode":"if (failureThreshold is <= 0 or > 1)\n    throw new ArgumentOutOfRangeException(nameof(failureThreshold), \"failureThreshold must be in (0,1].\");","typeGuard":"static bool IsValidFailureThreshold(double t) => t > 0 && t <= 1;","tryCatchPattern":null,"preventionTips":["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."],"tags":["circuit-breaker","argument-validation","legacy-api","configuration"],"backgroundTag":null,"analyzedSha":"d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac","analyzedAt":"2026-08-13T16:36:01.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}