{"record":{"id":"214382044939a3a2","repo":"App-vNext/Polly","slug":"value-must-be-less-than-or-equal-to-one","errorCode":null,"errorMessage":"Value must be less than or equal to one.","messagePattern":"Value must be less than or equal to one\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Polly/CircuitBreaker/AdvancedCircuitBreakerSyntax.cs","lineNumber":233,"sourceCode":"        this PolicyBuilder policyBuilder,\n        double failureThreshold,\n        TimeSpan samplingDuration,\n        int minimumThroughput,\n        TimeSpan durationOfBreak,\n        Action<Exception, 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/AdvancedCircuitBreakerSyntax.cs#L215-L251","documentation":"Thrown at policy-construction time by the legacy Polly v7 AdvancedCircuitBreaker when failureThreshold exceeds 1. failureThreshold is a proportion (max 1.0 = 100%); values above 1 are not a valid ratio and would make the breaker logically impossible to trip, so Polly rejects them with ArgumentOutOfRangeException.","triggerScenarios":"Calling AdvancedCircuitBreaker/Async with failureThreshold greater than 1.0 — typically passing a percentage (50, 100) instead of a fraction (0.5, 1.0).","commonSituations":"Storing/entering the threshold as a whole-number percentage and forgetting to divide by 100; config returning 100 meaning '100%' but passed directly.","solutions":["Pass failureThreshold as a fraction between 0 (exclusive) and 1 (inclusive).","If config is a percentage, convert: configPercent / 100.0 before calling.","Clamp to a maximum of 1.0 when reading from an external source."],"exampleFix":"// before\n.AdvancedCircuitBreaker(failureThreshold: 100, samplingDuration: ..., ...);\n// after\n.AdvancedCircuitBreaker(failureThreshold: 1.0, samplingDuration: ..., ...); // 100%","handlingStrategy":"validation","validationCode":"if (failureThreshold > 1) throw new ArgumentOutOfRangeException(nameof(failureThreshold), \"failureThreshold must be <= 1 (use a fraction, not a percentage).\");\n.AdvancedCircuitBreaker(failureThreshold, samplingDuration, minimumThroughput, durationOfBreak, onBreak, onReset, onHalfOpen);","typeGuard":"static bool IsFailureThresholdValid(double t) => t > 0 && t <= 1;","tryCatchPattern":null,"preventionTips":["Store and pass failureThreshold as a fraction (0.5 = 50%), never a whole-number percent.","Clamp external/config values to the (0,1] range.","Add an integration test that builds the breaker with realistic config."],"tags":["polly","circuit-breaker","legacy-v7","argument-out-of-range","failure-threshold","configuration"],"backgroundTag":null,"analyzedSha":"d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac","analyzedAt":"2026-08-13T16:36:01.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}