TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
Valid range is from 1 to 4.
Error message
Valid range is from 1 to 4.
What it means
Thrown by the ResolverConcurrency property setter when the value is outside [1, 4]. This caps how many concurrent upstream queries the resolver issues per name during resolution (e.g. querying multiple authoritative servers in parallel). The library bounds this to 1–4 to avoid excessive fan-out.
Source
Thrown at DnsServerCore/Dns/DnsServer.cs:7945
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 ResolverConcurrency
{
get { return _resolverConcurrency; }
set
{
if ((value < 1) || (value > 4))
throw new ArgumentOutOfRangeException(nameof(ResolverConcurrency), "Valid range is from 1 to 4.");
_resolverConcurrency = value;
}
}
public int ResolverMaxStackCount
{
get { return _resolverMaxStackCount; }
set
{
if ((value < 10) || (value > 30))
throw new ArgumentOutOfRangeException(nameof(ResolverMaxStackCount), "Valid range is from 10 to 30.");
_resolverMaxStackCount = value;
}
}
public bool SaveCacheToDiskView on GitHub (pinned to d0484b6c1e)
Solutions
- Use a value in 1–4 inclusive (2 is a reasonable default balancing speed and load).
- Clamp external config into the valid range before assignment.
- Prefer tuning ResolverRetries/Timeout over pushing concurrency past 4.
Example fix
// before server.ResolverConcurrency = 8; // after server.ResolverConcurrency = 4;
Defensive patterns
Strategy: validation
Validate before calling
static int ClampConcurrency(int v) => Math.Clamp(v, 1, 4); server.ResolverConcurrency = ClampConcurrency(configConcurrency);
Type guard
static bool IsValidResolverConcurrency(int v) => v >= 1 && v <= 4;
Try / catch
try { server.ResolverConcurrency = c; }
catch (ArgumentOutOfRangeException) { server.ResolverConcurrency = 2; } Prevention
- Clamp concurrency from config into 1–4.
- Don't try to exceed the cap for performance; tune retries/timeout instead.
- Validate before applying to avoid mid-startup exceptions.
When it happens
Trigger: Setting DnsServer.ResolverConcurrency to 0, a negative number, or a value greater than 4.
Common situations: Trying to raise concurrency expecting faster resolution; setting 0; reading an uncapped value from config.
Related errors
- Valid range is from 1 to 10.
- Valid range is from 10 to 30.
- Serve stale max wait time valid range is 0 to 1800 milliseco
- Value cannot be less than 1.
- TSIG keys cannot have more than 255 entries.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/b2c71efabf03b753.
Report an issue: GitHub.