TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
Valid range is from 1 to 10.
Error message
Valid range is from 1 to 10.
What it means
Thrown by the ResolverRetries property setter when the value is outside [1, 10]. This controls how many times the internal resolver retries an upstream query before giving up. Values below 1 would disable retries entirely (not permitted) and above 10 would waste time on dead upstreams.
Source
Thrown at DnsServerCore/Dns/DnsServer.cs:7921
public bool QnameMinimization
{
get { return _qnameMinimization; }
set { _qnameMinimization = value; }
}
public bool LocallyServedDnsZones
{
get { return _locallyServedDnsZones; }
set { _locallyServedDnsZones = value; }
}
public int ResolverRetries
{
get { return _resolverRetries; }
set
{
if ((value < 1) || (value > 10))
throw new ArgumentOutOfRangeException(nameof(ResolverRetries), "Valid range is from 1 to 10.");
_resolverRetries = value;
}
}
public int ResolverTimeout
{
get { return _resolverTimeout; }
set
{
if ((value < 1000) || (value > 10000))
throw new ArgumentOutOfRangeException(nameof(ResolverTimeout), "Valid range is from 1000 to 10000.");
_resolverTimeout = value;
}
}
public int ResolverConcurrencyView on GitHub (pinned to d0484b6c1e)
Solutions
- Pick a value between 1 and 10 inclusive (2–3 is a sensible default for most setups).
- If you wanted to minimize latency, use a lower value like 1–2 rather than 0.
- Validate config-sourced integers with a range clamp before assignment.
Example fix
// before server.ResolverRetries = 0; // after server.ResolverRetries = 2;
Defensive patterns
Strategy: validation
Validate before calling
static int ClampRetries(int v) => Math.Clamp(v, 1, 10); server.ResolverRetries = ClampRetries(configRetries);
Type guard
static bool IsValidResolverRetries(int v) => v >= 1 && v <= 10;
Try / catch
try { server.ResolverRetries = retries; }
catch (ArgumentOutOfRangeException) { server.ResolverRetries = 2; } Prevention
- Clamp all resolver tuning integers from config.
- Document units and ranges next to each setting.
- Unit-test config parsing against the documented bounds.
When it happens
Trigger: Setting DnsServer.ResolverRetries to 0, a negative number, or any integer greater than 10.
Common situations: Configuring retries from a UI/env var without bounds checking; setting 0 expecting "no retries"; raising it high hoping for more resilience against flaky upstreams.
Related errors
- Valid range is from 1 to 4.
- Valid range is from 10 to 30.
- Serve stale max wait time valid range is 0 to 1800 milliseco
- TSIG keys cannot have more than 255 entries.
- Value cannot be less than 1.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/cd3e7fee99e1eca5.
Report an issue: GitHub.