{"record":{"id":"0a057d4502d0b36f","repo":"App-vNext/Polly","slug":"value-must-be-equal-to-or-greater-than-resolution-0a057d","errorCode":null,"errorMessage":"Value must be equal to or greater than {resolutionOfCircuit.TotalMilliseconds} milliseconds. This is the minimum resolution of the CircuitBreaker timer.","messagePattern":"Value must be equal to or greater than (.+?) milliseconds\\. This is the minimum resolution of the CircuitBreaker timer\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Polly/CircuitBreaker/AdvancedCircuitBreakerTResultSyntax.cs","lineNumber":238,"sourceCode":"        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)\n        {\n            throw new ArgumentNullException(nameof(onBreak));\n        }\n\n        if (onReset == null)","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/App-vNext/Polly/blob/d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac/src/Polly/CircuitBreaker/AdvancedCircuitBreakerTResultSyntax.cs#L220-L256","documentation":"Thrown by AdvancedCircuitBreaker<T> when samplingDuration is below the circuit timer's minimum resolution of 20 milliseconds (ResolutionOfCircuitTimer = TimeSpan.FromMilliseconds(20).Ticks). The advanced breaker divides samplingDuration into windows, so it cannot operate below that resolution. Fires at policy build time.","triggerScenarios":"Calling AdvancedCircuitBreaker(..., samplingDuration: TimeSpan.FromMilliseconds(10), ...) or TimeSpan.Zero or a negative duration. The check is `samplingDuration < resolutionOfCircuit` where resolutionOfCircuit == 20ms.","commonSituations":"Passing TimeSpan.Zero as a placeholder, misconfiguring the unit (e.g. supplying milliseconds where seconds were intended yields an accidentally tiny window), or reading a 0/default value from config.","solutions":["Use a samplingDuration of at least 20ms; in practice prefer 1-30 seconds for meaningful throughput measurement.","Sanity-check the configured duration against TimeSpan.FromMilliseconds(20) before building the policy.","Verify config units (seconds vs milliseconds) are what the API expects."],"exampleFix":"// before\n.AdvancedCircuitBreaker(\n    failureThreshold: 0.5,\n    samplingDuration: TimeSpan.FromMilliseconds(5),\n    ...)\n\n// after\n.AdvancedCircuitBreaker(\n    failureThreshold: 0.5,\n    samplingDuration: TimeSpan.FromSeconds(10),\n    ...)","handlingStrategy":"validation","validationCode":"if (samplingDuration < TimeSpan.FromMilliseconds(20))\n    throw new ArgumentOutOfRangeException(nameof(samplingDuration), \"samplingDuration must be >= 20ms.\");","typeGuard":"static bool IsValidSamplingDuration(TimeSpan d) => d >= TimeSpan.FromMilliseconds(20);","tryCatchPattern":null,"preventionTips":["Verify config units (seconds vs milliseconds) before binding.","Never pass TimeSpan.Zero as a placeholder; use a real value.","Prefer seconds-scale sampling windows for production traffic."],"tags":["circuit-breaker","argument-validation","legacy-api","time-configuration"],"backgroundTag":null,"analyzedSha":"d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac","analyzedAt":"2026-08-13T16:36:01.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}