vitessio/vitess · error

FullyQualifiedHostname: lookup of the IP of this machine's h

Error message

FullyQualifiedHostname: lookup of the IP of this machine's hostname (%v) did not return any IP address

What it means

After resolving the hostname, FullyQualifiedHostname requires at least one IP address. This error is returned when net.LookupHost succeeds but returns an empty list — a defensive check for a condition that shouldn't normally happen but indicates no usable address for the machine.

Source

Thrown at go/netutil/netutil.go:76

func FullyQualifiedHostname() (string, error) {
	// The machine hostname (which is also returned by os.Hostname()) may not be
	// set to the FQDN, but only the first part of it e.g. "localhost" instead of
	// "localhost.localdomain".
	// To get the full FQDN, we do the following:

	// 1. Get the machine hostname. Example: localhost
	hostname, err := os.Hostname()
	if err != nil {
		return "", fmt.Errorf("FullyQualifiedHostname: failed to retrieve the hostname of this machine: %v", err)
	}

	// 2. Look up the IP address for that hostname. Example: 127.0.0.1
	ips, err := net.LookupHost(hostname)
	if err != nil {
		return "", fmt.Errorf("FullyQualifiedHostname: failed to lookup the IP of this machine's hostname (%v): %v", hostname, err)
	}
	if len(ips) == 0 {
		return "", fmt.Errorf("FullyQualifiedHostname: lookup of the IP of this machine's hostname (%v) did not return any IP address", hostname)
	}
	// If multiple IPs are returned, we only look at the first one.
	localIP := ips[0]

	// 3. Reverse lookup the IP. Example: localhost.localdomain
	resolvedHostnames, err := net.LookupAddr(localIP)
	if err != nil {
		return "", fmt.Errorf("FullyQualifiedHostname: failed to reverse lookup this machine's local IP (%v): %v", localIP, err)
	}
	if len(resolvedHostnames) == 0 {
		return "", fmt.Errorf("FullyQualifiedHostname: reverse lookup of this machine's local IP (%v) did not return any hostnames", localIP)
	}
	// If multiple hostnames are found, we return only the first one.
	// If multiple hostnames are listed e.g. in an entry in the /etc/hosts file,
	// the current Go implementation returns them in that order.
	// Example for an /etc/hosts entry:
	//   127.0.0.1	localhost.localdomain localhost
	// If the FQDN isn't returned by this function, check the order in the entry

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Fix host resolution so the hostname maps to at least one IP (add to /etc/hosts)
  2. Inspect /etc/nsswitch.conf hosts line for broken lookup modules
  3. Confirm `getent hosts $(hostname)` returns an address before restarting Vitess
  4. Upgrade/repair the local resolver if a custom NSS module returns empty results

Example fix

// /etc/hosts, before
(no entry for myhost)
// after
192.168.1.10 myhost
Defensive patterns

Strategy: validation

Validate before calling

h, _ := os.Hostname()
if ips, err := net.LookupHost(h); err != nil || len(ips) == 0 {
    return fmt.Errorf("no IP for hostname %q", h)
}

Try / catch

fqdn, err := netutil.FullyQualifiedHostname()
if err != nil {
    log.Warn("FQDN lookup failed", slog.Any("error", err))
    return fmt.Errorf("cannot determine FQDN: %w", err)
}

Prevention

When it happens

Trigger: net.LookupHost(hostname) returns zero IPs for the machine's hostname while FullyQualifiedHostname is executed (via backup, tablet registration, or URL population paths).

Common situations: Unusual resolver behavior with empty answers; hosts file entries with no address; custom resolvers (nsswitch modules) returning empty success.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/3f573000e6643850. Report an issue: GitHub.