AdguardTeam/AdGuardHome · warning
interface %s has no ipv4 addresses
Error message
interface %s has no ipv4 addresses
What it means
handlePatchSettingsHTTP failed to JSON-decode the request body into ReqPatchSettingsHTTP. Like the DNS variant, this is a malformed client request: invalid JSON, wrong field types, or empty body on the HTTP-settings PATCH endpoint.
Source
Thrown at internal/aghnet/dhcp_unix.go:74
var ip net.IP
var maskLen int
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
maskLen, _ = ip.DefaultMask().Size()
case *net.IPNet:
ip = a.IP
maskLen, _ = a.Mask.Size()
default:
continue
}
if ip = ip.To4(); ip != nil {
return netip.PrefixFrom(netip.AddrFrom4([4]byte(ip)), maskLen), nil
}
}
return netip.Prefix{}, fmt.Errorf("interface %s has no ipv4 addresses", iface.Name)
}
// checkOtherDHCPv4 sends a DHCP request to the specified network interface, and
// waits for a response for a period defined by defaultDiscoverTime. l must not
// be nil.
func checkOtherDHCPv4(
ctx context.Context,
l *slog.Logger,
iface *net.Interface,
) (ok bool, err error) {
var subnet netip.Prefix
if subnet, err = ifaceIPv4Subnet(iface); err != nil {
return false, err
}
// Resolve broadcast addr.
dst := netip.AddrPortFrom(BroadcastFromPref(subnet), 67).String()
var dstAddr *net.UDPAddrView on GitHub (pinned to b41aefbe51)
Solutions
- Lint the JSON payload before sending
- Check ReqPatchSettingsHTTP field types in the API docs and match them
- Ensure proxies don't truncate bodies and Content-Type is application/json
- Use the web UI to change settings while debugging the raw request
Example fix
// before
curl -X PATCH http://host/control/http_config -d '{"port": "80"}'
// after
curl -X PATCH http://host/control/http_config \
-H 'Content-Type: application/json' \
-d '{"port": 80}' Defensive patterns
Strategy: validation
Validate before calling
var req ReqPatchSettingsHTTP
if err := json.Unmarshal(body, &req); err != nil { return err } Type guard
func isValidPatchHTTP(body []byte) bool {
var r ReqPatchSettingsHTTP
return json.Unmarshal(body, &r) == nil
} Try / catch
if resp.StatusCode >= 400 {
// decode error payload; malformed JSON is caller's fault — fix body
} Prevention
- Marshal request structs instead of hand-writing JSON
- Set Content-Type and complete bodies through proxies
- Test PATCH endpoints with contract tests
When it happens
Trigger: PATCHing the HTTP/web-interface settings endpoint with syntactically invalid JSON or fields whose types don't match the expected struct (e.g. a number where a string address is expected).
Common situations: Automated scripts sending unescaped JSON; API version mismatch where field types changed; truncated request bodies behind a misconfigured proxy.
Related errors
- parsing json time: %w
- json time is nil
- interface %s has no ipv6 addresses
- invalid ip version %d
- found no dns servers in %s
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/ce6a23f01e1d574f.
Report an issue: GitHub.