AdguardTeam/AdGuardHome · error
parsing hardware address: %w
Error message
parsing hardware address: %w
What it means
Converting a stored lease database record to an in-memory lease failed because the HWAddr field is not a parseable MAC address (net.ParseMAC error). The leases.json entries must contain hardware addresses in standard colon/hyphen/dot notation.
Source
Thrown at internal/dhcpd/db.go:72
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2692.
expiryStr = l.Expiry.Format(time.RFC3339)
}
return &dbLease{
Expiry: expiryStr,
Hostname: l.Hostname,
HWAddr: l.HWAddr.String(),
IP: l.IP,
IsStatic: l.IsStatic,
}
}
// toLease converts *dbLease to *dhcpsvc.Lease.
func (dl *dbLease) toLease() (l *dhcpsvc.Lease, err error) {
mac, err := net.ParseMAC(dl.HWAddr)
if err != nil {
return nil, fmt.Errorf("parsing hardware address: %w", err)
}
expiry := time.Time{}
if !dl.IsStatic {
expiry, err = time.Parse(time.RFC3339, dl.Expiry)
if err != nil {
return nil, fmt.Errorf("parsing expiry time: %w", err)
}
}
return &dhcpsvc.Lease{
Expiry: expiry,
IP: dl.IP,
Hostname: dl.Hostname,
HWAddr: mac,
IsStatic: dl.IsStatic,
}, nil
}View on GitHub (pinned to b41aefbe51)
Solutions
- Inspect the HWAddr values in the leases file and fix malformed entries to standard MAC format (aa:bb:cc:dd:ee:ff)
- Delete or back up and remove the leases file to start fresh (leases will be re-acquired)
- Restore from backup if the DB is corrupted
Example fix
// before
{"HWAddr": "192.168.1.5"}
// after
{"HWAddr": "aa:bb:cc:dd:ee:ff"} Defensive patterns
Strategy: validation
Validate before calling
// before loading
for _, dl := range dbLeases {
if _, err := net.ParseMAC(dl.HWAddr); err != nil { /* skip or fix entry */ }
} Type guard
func isValidMAC(s string) bool { _, err := net.ParseMAC(s); return err == nil } Prevention
- Never hand-edit HWAddr fields
- Back up leases file before upgrades
When it happens
Trigger: Loading a leases.db/leases.json where a lease's HWAddr is empty, malformed (wrong digit count, invalid characters), or stored in an unsupported format.
Common situations: Corrupted lease DB after crash or disk issue; hand-edited lease files; lease DB written by an incompatible fork or version.
Related errors
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/b4f89d0d5fed52c6.
Report an issue: GitHub.