AdguardTeam/AdGuardHome · error

auth: parsing remote address: %w

Error message

auth: parsing remote address: %w

What it means

handleLogin failed to parse the client's remote address string with netip.ParseAddr, yielding an internal server error. The RemoteAddr-derived string is not a valid IP literal.

Source

Thrown at internal/home/authhttp.go:167

			return
		}
	}

	ip, err := realIP(r)
	if err != nil {
		web.logger.ErrorContext(
			ctx,
			"getting real ip",
			"remote_ip", remoteIPStr,
			slogutil.KeyError, err,
		)
	}

	remoteIP, err := netip.ParseAddr(remoteIPStr)
	if err != nil {
		web.writeErrorWithIP(
			ctx,
			fmt.Errorf("auth: parsing remote address: %w", err),
			r,
			w,
			http.StatusInternalServerError,
			r.RemoteAddr,
		)

		return
	}

	logIP := remoteIPStr
	if web.auth.trustedProxies.Contains(remoteIP.Unmap()) {
		logIP = ip.String()
	}

	cookie, err := newCookie(ctx, web.auth, req, remoteIPStr)
	if err != nil {
		web.writeErrorWithIP(ctx, err, r, w, http.StatusForbidden, logIP)

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Inspect r.RemoteAddr for the failing request and fix the upstream proxy/server producing it
  2. Ensure the Go http.Server is populating RemoteAddr as host:port normally does
  3. If behind a proxy, configure trusted proxies so the correct client IP is extracted
Defensive patterns

Strategy: try-catch

Try / catch

// server-side: treat as 500 but log RemoteAddr for diagnosis
if errors.Is(err, netip parse...) { log.ErrorContext(ctx, "bad RemoteAddr", "addr", r.RemoteAddr) }

Prevention

When it happens

Trigger: A request whose RemoteAddr host part is empty, malformed, or a hostname rather than an IP; typically a misbehaving or custom HTTP server/proxy in front of AdGuard Home.

Common situations: Malformed X-Forwarded-For handling, unusual proxies, unit tests with fake RemoteAddr values like "test".

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/618b6d17648231e0. Report an issue: GitHub.