vitessio/vitess · error

FullyQualifiedHostname: reverse lookup of this machine's loc

Error message

FullyQualifiedHostname: reverse lookup of this machine's local IP (%v) did not return any hostnames

What it means

After a successful reverse lookup, FullyQualifiedHostname requires at least one hostname in the answer. This defensive error is returned when net.LookupAddr succeeds but the result list is empty, so no FQDN can be chosen.

Source

Thrown at go/netutil/netutil.go:87

	// 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
	// in your /etc/hosts file.
	return strings.TrimSuffix(resolvedHostnames[0], "."), nil
}

// FullyQualifiedHostnameOrPanic is the same as FullyQualifiedHostname
// but panics in case of an error.
func FullyQualifiedHostnameOrPanic() string {
	hostname, err := FullyQualifiedHostname()
	if err != nil {
		panic(err)
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Add a /etc/hosts reverse mapping for the machine's IP with the FQDN first
  2. Fix the DNS zone so a PTR record exists for the IP
  3. Check /etc/nsswitch.conf for resolver modules that swallow results
  4. Pass the hostname explicitly to Vitess rather than deriving it

Example fix

// /etc/hosts, before
10.0.0.5
// after
10.0.0.5 tablet-1.example.com tablet-1
Defensive patterns

Strategy: fallback

Validate before calling

ip, _ := net.LookupHost(os.Hostname())
if len(ip) > 0 {
    names, err := net.LookupAddr(ip[0])
    if err != nil || len(names) == 0 {
        return fmt.Errorf("no reverse names for %s", ip[0])
    }
}

Try / catch

fqdn, err := netutil.FullyQualifiedHostname()
if err != nil {
    fqdn = cfg.ExplicitHostname // fall back to configured hostname
}

Prevention

When it happens

Trigger: net.LookupAddr(localIP) returns zero names during FullyQualifiedHostname execution (backup, tablet registration, listening URL population).

Common situations: DNS servers replying successfully with zero-answer responses; custom resolver/NSS modules returning empty success; misconfigured DNS zones with no PTR data but NXDOMAIN suppressed.

Related errors


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