TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
Serve stale reset TTL must be between {SERVE_STALE_MIN_RESET
Error message
Serve stale reset TTL must be between {SERVE_STALE_MIN_RESET_TTL} and {SERVE_STALE_MAX_RESET_TTL} seconds. Recommended value is 30 seconds. What it means
Thrown by the ServeStaleResetTtl property setter when value is below SERVE_STALE_MIN_RESET_TTL or above SERVE_STALE_MAX_RESET_TTL. Serve-stale (serving expired records while refreshing) uses this reset TTL; the bounds keep behavior sane. The recommended value of 30 seconds is noted in the message.
Source
Thrown at DnsServerCore/Dns/ZoneManagers/CacheZoneManager.cs:1225
return null; //no cached delegation found
}
}
//no cached delegation found
return null;
}
#endregion
#region properties
public uint ServeStaleResetTtl
{
get { return _serveStaleResetTtl; }
set
{
if ((value < SERVE_STALE_MIN_RESET_TTL) || (value > SERVE_STALE_MAX_RESET_TTL))
throw new ArgumentOutOfRangeException(nameof(ServeStaleResetTtl), "Serve stale reset TTL must be between " + SERVE_STALE_MIN_RESET_TTL + " and " + SERVE_STALE_MAX_RESET_TTL + " seconds. Recommended value is 30 seconds.");
_serveStaleResetTtl = value;
}
}
public long MaximumEntries
{
get { return _maximumEntries; }
set
{
if (value < 0)
throw new ArgumentOutOfRangeException(nameof(MaximumEntries), "Invalid cache maximum entries value. Valid range is 0 and above.");
_maximumEntries = value;
}
}
public long TotalEntriesView on GitHub (pinned to d0484b6c1e)
Solutions
- Set ServeStaleResetTtl to a value within [SERVE_STALE_MIN_RESET_TTL, SERVE_STALE_MAX_RESET_TTL]; use the recommended 30 seconds if unsure.
- Confirm the unit is seconds, not milliseconds.
- Read the named constants' values from the class to know the exact bounds before configuring.
Example fix
// before _cacheZoneManager.ServeStaleResetTtl = 0; // below min -> throws // after _cacheZoneManager.ServeStaleResetTtl = 30; // recommended value (seconds)
Defensive patterns
Strategy: validation
Validate before calling
uint ttl = value;
if (ttl < CacheZoneManager.SERVE_STALE_MIN_RESET_TTL || ttl > CacheZoneManager.SERVE_STALE_MAX_RESET_TTL)
ttl = 30u; // recommended default
cacheZoneManager.ServeStaleResetTtl = ttl; Type guard
static bool IsValidServeStaleResetTtl(uint v) => v >= CacheZoneManager.SERVE_STALE_MIN_RESET_TTL && v <= CacheZoneManager.SERVE_STALE_MAX_RESET_TTL;
Try / catch
try { cacheZoneManager.ServeStaleResetTtl = value; }
catch (ArgumentOutOfRangeException) { cacheZoneManager.ServeStaleResetTtl = 30u; } Prevention
- Reference the class constants for exact bounds rather than guessing.
- Use the recommended 30 seconds when in doubt.
- Remember the unit is seconds, not milliseconds.
- Clamp config values at the UI/config boundary.
When it happens
Trigger: Setting ServeStaleResetTtl to 0, a sub-minimum value, or above the maximum; unit confusion (passing milliseconds into a seconds field).
Common situations: Tuning serve-stale and entering an out-of-range number; config import with an invalid value; assuming 0 disables it (it does not - the field has a positive minimum).
Related errors
- Serve stale max wait time valid range is 0 to 1800 milliseco
- Invalid cache maximum entries value. Valid range is 0 and ab
- 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/cab0ac948254d4f8.
Report an issue: GitHub.