TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException

Valid range is between 1 and 60 minutes.

Error message

Valid range is between 1 and 60 minutes.

What it means

Thrown by the QpmLimitSampleMinutes property setter when the value is below 1 or above 60. This controls the time window (in minutes) over which Queries-Per-Minute limits are sampled and computed.

Source

Thrown at DnsServerCore/Dns/DnsServer.cs:7468

                        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();
            }
        }

        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

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Set a value between 1 and 60 minutes (e.g. 5 for a typical rolling window).
  2. If loading from a config that uses seconds, convert: value = seconds / 60.

Example fix

// before
server.QpmLimitSampleMinutes = 0; // throws

// after
server.QpmLimitSampleMinutes = 5;
Defensive patterns

Strategy: validation

Validate before calling

int safeMinutes = Math.Clamp(value, 1, 60);
server.QpmLimitSampleMinutes = safeMinutes;

Type guard

static bool IsValidSampleMinutes(int m) => m >= 1 && m <= 60;

Try / catch

try { server.QpmLimitSampleMinutes = value; }
catch (ArgumentOutOfRangeException) { server.QpmLimitSampleMinutes = 5; }

Prevention

When it happens

Trigger: Setting server.QpmLimitSampleMinutes to an int < 1 or > 60.

Common situations: Setting 0 to disable sampling (does not work — use the limits themselves); setting a very large window; config file with a wrong unit (seconds instead of minutes).

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/fc210fb46aba79e3. Report an issue: GitHub.