TechnitiumSoftware/DnsServer · error · ArgumentException
Boot file name cannot exceed 127 bytes.
Error message
Boot file name cannot exceed 127 bytes.
What it means
Thrown by the BootFileName setter when a non-null value has Length >= 128. DHCP boot file names occupy the 128-byte 'file' field in the message, so values of 128 characters or more are rejected (max 127 usable).
Source
Thrown at DnsServerCore/Dhcp/Scope.cs:2013
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 RouterAddress
{
get { return _routerAddress; }
set
{
ValidateIpv4(value, nameof(RouterAddress));
_routerAddress = value;
}
}
public bool UseThisDnsServer
{
get { return _useThisDnsServer; }View on GitHub (pinned to d0484b6c1e)
Solutions
- Use a boot file name (path) of at most 127 characters before assignment.
- Store longer paths elsewhere (e.g. an option) and pass a short reference here.
- Validate input length in your config/UI layer.
- For non-ASCII ensure the UTF-8 byte length stays under 128.
Example fix
// before scope.BootFileName = bootPath; // may exceed 127 // after scope.BootFileName = (bootPath == null || bootPath.Length <= 127) ? bootPath : bootPath.Substring(0, 127);
Defensive patterns
Strategy: validation
Validate before calling
if (bootFile != null && Encoding.UTF8.GetByteCount(bootFile) >= 128)
throw new ConfigurationException("BootFileName must be <= 127 bytes");
scope.BootFileName = bootFile; Type guard
static bool IsValidBootFileName(string s)
=> s == null || Encoding.UTF8.GetByteCount(s) <= 127; Try / catch
try { scope.BootFileName = value; }
catch (ArgumentException ex) when (ex.Message.Contains("Boot file name"))
{ /* shorten and retry */ } Prevention
- Pass a relative boot file path, not an absolute filesystem path.
- Validate length (and UTF-8 byte length) in config.
- Store long paths in a DHCP option instead of the file field.
When it happens
Trigger: Assigning scope.BootFileName = value where value != null && value.Length >= 128. Happens with deeply nested PXE boot paths or absolute paths placed in the field.
Common situations: Config with a full absolute path, templated boot file strings, or unvalidated input that exceeds the DHCP file-field limit.
Related errors
- Server host name cannot exceed 63 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/bbe084682916d057.
Report an issue: GitHub.