vitessio/vitess · critical

FullyQualifiedHostname: failed to retrieve the hostname of t

Error message

FullyQualifiedHostname: failed to retrieve the hostname of this machine: %v

What it means

FullyQualifiedHostname builds the machine's FQDN and first calls os.Hostname(). This error means the OS itself failed to return the local hostname, so the FQDN cannot be derived. It almost always indicates a broken local hostname configuration (e.g. unset/invalid hostname or resource limits).

Source

Thrown at go/netutil/netutil.go:67

}

// JoinHostPort is an extension to net.JoinHostPort that also formats the
// integer port.
func JoinHostPort(host string, port int32) string {
	return net.JoinHostPort(host, strconv.FormatInt(int64(port), 10))
}

// FullyQualifiedHostname returns the FQDN of the machine.
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)
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Fix the machine's hostname (e.g. `hostnamectl set-hostname myhost` or docker `--hostname`) and retry
  2. Verify the hostname resolves locally: `hostname` should return a non-empty name
  3. Restart the container/pod with a valid hostname setting
  4. If panic path (FullyQualifiedHostnameOrPanic), set a valid hostname before starting the Vitess binary

Example fix

// shell, before
$ hostname
(empty or errors)
// after
$ sudo hostnamectl set-hostname tablet-1
$ hostname
tablet-1
Defensive patterns

Strategy: fallback

Validate before calling

if h, err := os.Hostname(); err != nil || h == "" {
    return fmt.Errorf("hostname unavailable: %v", err)
}

Try / catch

fqdn, err := netutil.FullyQualifiedHostname()
if err != nil {
    log.Warn("FQDN lookup failed, falling back to os.Hostname", slog.Any("error", err))
    fqdn, err = os.Hostname()
}

Prevention

When it happens

Trigger: Calling FullyQualifiedHostname / FullyQualifiedHostnameOrPanic (or anything that calls it: vtctld BuildTabletFromInput, backup ExecuteBackup/executeFullBackup, populateListeningURL) when os.Hostname() fails on the host.

Common situations: Containers with misconfigured/empty hostname; hosts whose hostname exceeds OS limits; systems under fd/memory pressure where the syscall fails.

Related errors


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