{"record":{"id":"f6f6ee3c9934361c","repo":"App-vNext/Polly","slug":"value-must-be-greater-than-one","errorCode":null,"errorMessage":"Value must be greater than one.","messagePattern":"Value must be greater than one\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Polly/CircuitBreaker/AdvancedCircuitBreakerSyntax.cs","lineNumber":243,"sourceCode":"\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)\n        {\n            throw new ArgumentNullException(nameof(onBreak));\n        }\n\n        if (onReset == null)\n        {\n            throw new ArgumentNullException(nameof(onReset));\n        }\n\n        if (onHalfOpen == null)","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/App-vNext/Polly/blob/d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac/src/Polly/CircuitBreaker/AdvancedCircuitBreakerSyntax.cs#L225-L261","documentation":"Thrown at policy-construction time by the legacy Polly v7 AdvancedCircuitBreaker when minimumThroughput is less than or equal to 1. minimumThroughput is the minimum number of actions that must pass through the circuit in a sampling window before failure statistics are considered significant; a value of 0 or 1 makes the breaker unreliable (a single failure could trip it), so Polly requires at least 2 via ArgumentOutOfRangeException.","triggerScenarios":"Calling AdvancedCircuitBreaker/Async with minimumThroughput of 0, 1, or a negative int.","commonSituations":"Config value missing and defaulted to 0; copy-paste from a doc example that used a placeholder; misunderstanding that this is a count (>=2) not a ratio.","solutions":["Set minimumThroughput to an integer >= 2 (typical values are in the tens, e.g. 10).","Validate configured throughput and fall back to a default (e.g. 10) when it is <= 1.","Double-check the parameter is a count, not a percentage or fraction."],"exampleFix":"// before\n.AdvancedCircuitBreaker(0.5, sampling, 1, breakDur, ...);\n// after\n.AdvancedCircuitBreaker(0.5, sampling, 10, breakDur, ...);","handlingStrategy":"validation","validationCode":"if (minimumThroughput <= 1) throw new ArgumentOutOfRangeException(nameof(minimumThroughput), \"minimumThroughput must be >= 2.\");\n.AdvancedCircuitBreaker(failureThreshold, samplingDuration, minimumThroughput, durationOfBreak, onBreak, onReset, onHalfOpen);","typeGuard":"static bool IsMinimumThroughputValid(int n) => n >= 2;","tryCatchPattern":null,"preventionTips":["Set minimumThroughput to a count >= 2 (tens are typical, e.g. 10).","Default to a sensible value when config is missing or 0.","Remember this is an action count, not a ratio or percentage."],"tags":["polly","circuit-breaker","legacy-v7","argument-out-of-range","minimum-throughput","configuration"],"backgroundTag":null,"analyzedSha":"d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac","analyzedAt":"2026-08-13T16:36:01.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}