TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
Percentage value valid range is between 0 and 100.
Error message
Percentage value valid range is between 0 and 100.
What it means
Thrown by the QpmLimitUdpTruncationPercentage property setter when the value is below 0 or above 100. This percentage controls how often UDP responses are truncated (TC bit) when QPM limits are exceeded, before the limit hard-blocks queries.
Source
Thrown at DnsServerCore/Dns/DnsServer.cs:7480
public int QpmLimitSampleMinutes
{
get { return _qpmLimitSampleMinutes; }
set
{
if ((value < 1) || (value > 60))
throw new ArgumentOutOfRangeException(nameof(QpmLimitSampleMinutes), "Valid range is between 1 and 60 minutes.");
_qpmLimitSampleMinutes = value;
}
}
public int QpmLimitUdpTruncationPercentage
{
get { return _qpmLimitUdpTruncationPercentage; }
set
{
if ((value < 0) || (value > 100))
throw new ArgumentOutOfRangeException(nameof(QpmLimitUdpTruncationPercentage), "Percentage value valid range is between 0 and 100.");
_qpmLimitUdpTruncationPercentage = value;
}
}
public IReadOnlyCollection<NetworkAddress> QpmLimitBypassList
{
get { return _qpmLimitBypassList; }
set
{
if ((value is null) || (value.Count == 0))
_qpmLimitBypassList = null;
else if (value.Count > byte.MaxValue)
throw new ArgumentOutOfRangeException(nameof(QpmLimitBypassList), "Networks cannot have more than 255 entries.");
else
_qpmLimitBypassList = value;
}
}View on GitHub (pinned to d0484b6c1e)
Solutions
- Set a value between 0 and 100 inclusive (e.g. 50 for 50% truncation).
- If your config uses a 0-1 float, multiply by 100 and round before assignment.
Example fix
// before server.QpmLimitUdpTruncationPercentage = 150; // throws // after server.QpmLimitUdpTruncationPercentage = 50;
Defensive patterns
Strategy: validation
Validate before calling
int safePct = Math.Clamp(value, 0, 100); server.QpmLimitUdpTruncationPercentage = safePct;
Type guard
static bool IsValidPercentage(int p) => p >= 0 && p <= 100;
Try / catch
try { server.QpmLimitUdpTruncationPercentage = value; }
catch (ArgumentOutOfRangeException) { server.QpmLimitUdpTruncationPercentage = 50; } Prevention
- If config uses 0.0-1.0 floats, multiply by 100 and round first.
- Use Math.Clamp on loaded values.
When it happens
Trigger: Setting server.QpmLimitUdpTruncationPercentage to an int < 0 or > 100.
Common situations: Passing a fraction (e.g. 0.5) as an integer resulting in 0 unexpectedly; config file with a value like 150; misunderstanding that 0 means never truncate and 100 means always truncate.
Related errors
- QPM Prefix Limits for IPv4 cannot have more than 255 entries
- QPM Prefix Limits for IPv6 cannot have more than 255 entries
- Valid range is between 1 and 60 minutes.
- Invalid EDNS UDP payload size: valid range is 512-4096 bytes
- QPM limit IPv4 prefix valid range is between 0 and 32.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/e704a948be5774f2.
Report an issue: GitHub.