TechnitiumSoftware/DnsServer · error · ArgumentException
Server host name cannot exceed 63 bytes.
Error message
Server host name cannot exceed 63 bytes.
What it means
Thrown by the ServerHostName setter when a non-null value has Length >= 64. DHCP server host names are bounded by the 64-byte sname field in the DHCP message, so the library rejects anything that would not fit (max 63 usable characters).
Source
Thrown at DnsServerCore/Dhcp/Scope.cs:2001
}
public IPAddress ServerAddress
{
get { return _serverAddress; }
set
{
ValidateIpv4(value, nameof(ServerAddress));
_serverAddress = value;
}
}
public string ServerHostName
{
get { return _serverHostName; }
set
{
if ((value != null) && (value.Length >= 64))
throw new ArgumentException("Server host name cannot exceed 63 bytes.");
_serverHostName = value;
}
}
public string BootFileName
{
get { return _bootFileName; }
set
{
if ((value != null) && (value.Length >= 128))
throw new ArgumentException("Boot file name cannot exceed 127 bytes.");
_bootFileName = value;
}
}
public IPAddress RouterAddressView on GitHub (pinned to d0484b6c1e)
Solutions
- Truncate or choose a host name of at most 63 characters before assignment.
- Validate input length in your config/UI layer.
- If the FQDN is too long, use a short hostname instead.
- Note: the check is on character Length; for non-ASCII ensure byte length also stays under 64.
Example fix
// before scope.ServerHostName = fqdn; // may exceed 63 // after scope.ServerHostName = (fqdn == null || fqdn.Length <= 63) ? fqdn : fqdn.Substring(0, 63);
Defensive patterns
Strategy: validation
Validate before calling
if (hostName != null && Encoding.UTF8.GetByteCount(hostName) >= 64)
throw new ConfigurationException("ServerHostName must be <= 63 bytes");
scope.ServerHostName = hostName; Type guard
static bool IsValidServerHostName(string s)
=> s == null || Encoding.UTF8.GetByteCount(s) <= 63; Try / catch
try { scope.ServerHostName = value; }
catch (ArgumentException ex) when (ex.Message.Contains("Server host name"))
{ /* truncate and retry, or prompt user */ } Prevention
- Use a short hostname, not the full FQDN, for DHCP sname.
- Validate length (and UTF-8 byte length for non-ASCII) in config.
- Unit-test with a 64+ character input.
When it happens
Trigger: Assigning scope.ServerHostName = value where value != null && value.Length >= 64. Occurs when the host name is an FQDN with many labels, a stale long value, or unvalidated user input.
Common situations: Config importing the machine FQDN verbatim, templated names that exceed 63 chars, or forgetting the 63-byte DHCP limit.
Related errors
- Boot file name cannot exceed 127 bytes.
- Ending address must be greater than starting address.
- Lease time in days must be between 0 to 999.
- Lease time in hours must be between 0 to 23.
- Lease time in minutes must be between 0 to 59.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/db853a86e1a4646a.
Report an issue: GitHub.