{"record":{"id":"3f573000e6643850","repo":"vitessio/vitess","slug":"fullyqualifiedhostname-lookup-of-the-ip-of-this-m","errorCode":null,"errorMessage":"FullyQualifiedHostname: lookup of the IP of this machine's hostname (%v) did not return any IP address","messagePattern":"FullyQualifiedHostname: lookup of the IP of this machine's hostname \\((.+?)\\) did not return any IP address","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/netutil/netutil.go","lineNumber":76,"sourceCode":"func FullyQualifiedHostname() (string, error) {\n\t// The machine hostname (which is also returned by os.Hostname()) may not be\n\t// set to the FQDN, but only the first part of it e.g. \"localhost\" instead of\n\t// \"localhost.localdomain\".\n\t// To get the full FQDN, we do the following:\n\n\t// 1. Get the machine hostname. Example: localhost\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"FullyQualifiedHostname: failed to retrieve the hostname of this machine: %v\", err)\n\t}\n\n\t// 2. Look up the IP address for that hostname. Example: 127.0.0.1\n\tips, err := net.LookupHost(hostname)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"FullyQualifiedHostname: failed to lookup the IP of this machine's hostname (%v): %v\", hostname, err)\n\t}\n\tif len(ips) == 0 {\n\t\treturn \"\", fmt.Errorf(\"FullyQualifiedHostname: lookup of the IP of this machine's hostname (%v) did not return any IP address\", hostname)\n\t}\n\t// If multiple IPs are returned, we only look at the first one.\n\tlocalIP := ips[0]\n\n\t// 3. Reverse lookup the IP. Example: localhost.localdomain\n\tresolvedHostnames, err := net.LookupAddr(localIP)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"FullyQualifiedHostname: failed to reverse lookup this machine's local IP (%v): %v\", localIP, err)\n\t}\n\tif len(resolvedHostnames) == 0 {\n\t\treturn \"\", fmt.Errorf(\"FullyQualifiedHostname: reverse lookup of this machine's local IP (%v) did not return any hostnames\", localIP)\n\t}\n\t// If multiple hostnames are found, we return only the first one.\n\t// If multiple hostnames are listed e.g. in an entry in the /etc/hosts file,\n\t// the current Go implementation returns them in that order.\n\t// Example for an /etc/hosts entry:\n\t//   127.0.0.1\tlocalhost.localdomain localhost\n\t// If the FQDN isn't returned by this function, check the order in the entry","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/netutil/netutil.go#L58-L94","documentation":"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.","triggerScenarios":"net.LookupHost(hostname) returns zero IPs for the machine's hostname while FullyQualifiedHostname is executed (via backup, tablet registration, or URL population paths).","commonSituations":"Unusual resolver behavior with empty answers; hosts file entries with no address; custom resolvers (nsswitch modules) returning empty success.","solutions":["Fix host resolution so the hostname maps to at least one IP (add to /etc/hosts)","Inspect /etc/nsswitch.conf hosts line for broken lookup modules","Confirm `getent hosts $(hostname)` returns an address before restarting Vitess","Upgrade/repair the local resolver if a custom NSS module returns empty results"],"exampleFix":"// /etc/hosts, before\n(no entry for myhost)\n// after\n192.168.1.10 myhost","handlingStrategy":"validation","validationCode":"h, _ := os.Hostname()\nif ips, err := net.LookupHost(h); err != nil || len(ips) == 0 {\n    return fmt.Errorf(\"no IP for hostname %q\", h)\n}","typeGuard":null,"tryCatchPattern":"fqdn, err := netutil.FullyQualifiedHostname()\nif err != nil {\n    log.Warn(\"FQDN lookup failed\", slog.Any(\"error\", err))\n    return fmt.Errorf(\"cannot determine FQDN: %w\", err)\n}","preventionTips":["Verify `getent hosts $(hostname)` returns an address on every node","Audit /etc/nsswitch.conf for resolver modules that can return empty results","Add DNS checks to pre-start validation"],"tags":["network","dns","hostname"],"backgroundTag":"hostname-resolution-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}