AdguardTeam/AdGuardHome · warning
failed to get addresses for interface %s: %w
Error message
failed to get addresses for interface %s: %w
What it means
Thrown by newNetInterfaceJSON when the Go standard library's net.Interface.Addrs() fails while enumerating a network interface for GET /control/dhcp/interfaces. The wrapped syscall error usually reports a deleted interface (ENODEV), permission problems, or a /proc/net state that changed during enumeration.
Source
Thrown at internal/dhcpd/http_unix.go:470
if jsonIface != nil {
resp[iface.Name] = jsonIface
}
}
aghhttp.WriteJSONResponseOK(ctx, l, w, r, resp)
}
// newNetInterfaceJSON creates a JSON object from a [net.Interface] iface.
// l and cmdCons must not be nil.
func newNetInterfaceJSON(
ctx context.Context,
l *slog.Logger,
iface net.Interface,
cmdCons executil.CommandConstructor,
) (out *netInterfaceJSON, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, fmt.Errorf(
"failed to get addresses for interface %s: %w",
iface.Name,
err,
)
}
out = &netInterfaceJSON{
Name: iface.Name,
HardwareAddr: iface.HardwareAddr.String(),
}
if iface.Flags != 0 {
out.Flags = iface.Flags.String()
}
// We don't want link-local addresses in JSON, so skip them.
for _, addr := range addrs {
ipNet, ok := addr.(*net.IPNet)View on GitHub (pinned to b41aefbe51)
Solutions
- Retry the request — transient interface churn usually resolves within milliseconds
- If it persists, check the named interface still exists with ip link show <name>
- In containers, ensure /proc is mounted and the runtime grants network visibility (e.g. don't use a network-degraded sandbox)
- Avoid triggering the interfaces endpoint in tight loops while scripts are flapping interfaces
Defensive patterns
Strategy: retry
Validate before calling
if _, err := net.InterfaceByName(iface.Name); err != nil {
return // interface vanished; skip it instead of calling Addrs
} Try / catch
var out *netInterfaceJSON
var err error
for i := 0; i < 3; i++ {
out, err = newNetInterfaceJSON(log, iface, cmdCons)
if err == nil { break }
time.Sleep(50 * time.Millisecond)
} Prevention
- Treat interface enumeration as best-effort: skip failed interfaces instead of failing the whole list
- Retry once on transient ENODEV during interface churn
- Pin down when interfaces flap (VPN scripts) and avoid querying during those windows
When it happens
Trigger: Calling GET /control/dhcp/interfaces while an interface (VPN tun, docker veth, USB NIC) is being created or destroyed, so Addrs() races with the interface disappearing; or running in a restricted container where reading interface addresses is denied.
Common situations: Dashboard loading the DHCP page exactly when a VPN connects/disconnects; Docker/Kubernetes environments with ephemeral veth devices; chroots without /proc mounted; heavily transient network namespaces.
Related errors
- checking static ip: %w
- setting static ip: %w
- starting dhcp server: %w
- invalid bind_host value: %s
- %v is not an IPv4 %s
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/381f3aa7c5770c15.
Report an issue: GitHub.