TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
Value must be between 1 hour and 168 hours (7 days) or 0 to
Error message
Value must be between 1 hour and 168 hours (7 days) or 0 to disable automatic update.
What it means
Thrown by the BlockListUpdateIntervalHours setter when value is < 0 or > 168. The valid range is 0 (disable automatic update) up to 168 hours (7 days); values outside that are an ArgumentOutOfRangeException.
Source
Thrown at DnsServerCore/Dns/ZoneManagers/BlockListZoneManager.cs:1088
}
if (uniqueList.Count == commentCount)
uniqueList = [];
value = uniqueList;
}
ApplyBlockListUrls(value);
}
}
public int BlockListUpdateIntervalHours
{
get { return _blockListUpdateIntervalHours; }
set
{
if ((value < 0) || (value > 168))
throw new ArgumentOutOfRangeException(nameof(BlockListUpdateIntervalHours), "Value must be between 1 hour and 168 hours (7 days) or 0 to disable automatic update.");
_blockListUpdateIntervalHours = value;
ApplyBlockListUpdateInterval();
}
}
public bool BlockListUpdateEnabled
{ get { return _blockListUpdateTimer is not null; } }
public DateTime BlockListLastUpdatedOn
{
get { return _blockListLastUpdatedOn; }
internal set
{
_blockListLastUpdatedOn = value;
}
}View on GitHub (pinned to d0484b6c1e)
Solutions
- Pass a value in [0, 168] hours (e.g. 24 for daily, 0 to disable).
- If you intended a longer interval, choose 168 (the max) and rely on manual updates beyond that.
- Double-check the unit is hours, not minutes.
Example fix
// before blockListZoneManager.BlockListUpdateIntervalHours = 240; // > 168 -> throws // after blockListZoneManager.BlockListUpdateIntervalHours = 168; // max = 7 days, or 0 to disable
Defensive patterns
Strategy: validation
Validate before calling
const int MaxHours = 168; int hours = Math.Clamp(requestedHours, 0, MaxHours); blockListZoneManager.BlockListUpdateIntervalHours = hours;
Type guard
static bool IsValidUpdateInterval(int hours) => hours >= 0 && hours <= 168;
Try / catch
try { blockListZoneManager.BlockListUpdateIntervalHours = hours; }
catch (ArgumentOutOfRangeException) { blockListZoneManager.BlockListUpdateIntervalHours = Math.Clamp(hours, 0, 168); } Prevention
- Remember the field is HOURS, not minutes or days.
- Use 0 to disable automatic updates explicitly.
- Clamp user-supplied values at the configuration boundary.
- Document the 0..168 range in your config UI.
When it happens
Trigger: Setting the auto-update interval to a negative number; setting it above 168 (e.g. 200 hours, or treating the field as minutes/days by mistake).
Common situations: Unit confusion (passing minutes or days into an hours field); config import with a stale/out-of-range value; script computing the interval arithmetically and overflowing.
Related errors
- Cannot configure more than 255 block list URLs.
- Block list URL (or comment line) length cannot exceed 255 ch
- DNS-over-HTTP Real IP header name cannot exceed 255 characte
- DNS-over-HTTP Real IP header name cannot contain invalid cha
- TSIG keys cannot have more than 255 entries.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/f7f7f3a802c6b0b1.
Report an issue: GitHub.