TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
QPM Prefix Limits for IPv6 cannot have more than 255 entries
Error message
QPM Prefix Limits for IPv6 cannot have more than 255 entries.
What it means
Thrown by the QpmPrefixLimitsIPv6 property setter when the dictionary has more than 255 entries. QPM IPv6 prefix limits are serialized with a byte count, capping entries at 255. A null value resets to an empty dictionary.
Source
Thrown at DnsServerCore/Dns/DnsServer.cs:7442
_qpmPrefixLimitsIPv4 = value;
}
ResetQpsLimitTimer();
}
}
public IReadOnlyDictionary<int, (int, int)> QpmPrefixLimitsIPv6
{
get { return _qpmPrefixLimitsIPv6; }
set
{
if (value is null)
{
_qpmPrefixLimitsIPv6 = new Dictionary<int, (int, int)>();
}
else if (value.Count > byte.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(QpmPrefixLimitsIPv6), "QPM Prefix Limits for IPv6 cannot have more than 255 entries.");
}
else
{
foreach (KeyValuePair<int, (int, int)> qpmPrefixLimit in value)
{
if ((qpmPrefixLimit.Key < 0) || (qpmPrefixLimit.Key > 128))
throw new ArgumentOutOfRangeException(nameof(QpmPrefixLimitsIPv6), "QPM limit IPv6 prefix valid range is between 0 and 128.");
if ((qpmPrefixLimit.Value.Item1 < 0) || (qpmPrefixLimit.Value.Item2 < 0))
throw new ArgumentOutOfRangeException(nameof(QpmPrefixLimitsIPv6), "QPM limit value cannot be less than 0.");
}
_qpmPrefixLimitsIPv6 = value;
}
ResetQpsLimitTimer();
}
}View on GitHub (pinned to d0484b6c1e)
Solutions
- Reduce to 255 or fewer entries; there are only 129 valid IPv6 prefix lengths (0-128).
- Check for duplicate or redundant keys.
- Set to null to clear.
Example fix
// before
server.QpmPrefixLimitsIPv6 = oversizedMap; // >255
// after
server.QpmPrefixLimitsIPv6 =
oversizedMap.Take(128).ToDictionary(k => k.Key, v => v.Value); Defensive patterns
Strategy: validation
Validate before calling
if (qpmV6.Count > 255)
qpmV6 = qpmV6.Take(255).ToDictionary(k => k.Key, v => v.Value);
server.QpmPrefixLimitsIPv6 = qpmV6; Type guard
static bool IsValidQpmDict(Dictionary<int,(int,int)> d) =>
d is null || d.Count <= 255; Try / catch
try { server.QpmPrefixLimitsIPv6 = qpmV6; }
catch (ArgumentOutOfRangeException) { qpmV6 = qpmV6.Take(255).ToDictionary(k=>k.Key,v=>v.Value); server.QpmPrefixLimitsIPv6 = qpmV6; } Prevention
- Only 129 valid IPv6 prefix lengths (0-128) exist — dedupe before building.
- Cap dictionary size during generation.
When it happens
Trigger: Assigning server.QpmPrefixLimitsIPv6 a dictionary with Count > 255.
Common situations: Generating one entry per possible IPv6 prefix length (0-128 is only 129, so this needs duplicates or an overly-generated set); loading a malformed external config.
Related errors
- QPM Prefix Limits for IPv4 cannot have more than 255 entries
- QPM limit IPv6 prefix valid range is between 0 and 128.
- Valid range is between 1 and 60 minutes.
- Percentage value valid range is between 0 and 100.
- EDNS Client Subnet IPv6 prefix length cannot be greater than
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/5d48f214b97be4ef.
Report an issue: GitHub.