{"record":{"id":"a9824b2d14e0ee16","repo":"vitessio/vitess","slug":"fullyqualifiedhostname-reverse-lookup-of-this-mac","errorCode":null,"errorMessage":"FullyQualifiedHostname: reverse lookup of this machine's local IP (%v) did not return any hostnames","messagePattern":"FullyQualifiedHostname: reverse lookup of this machine's local IP \\((.+?)\\) did not return any hostnames","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/netutil/netutil.go","lineNumber":87,"sourceCode":"\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\n\t// in your /etc/hosts file.\n\treturn strings.TrimSuffix(resolvedHostnames[0], \".\"), nil\n}\n\n// FullyQualifiedHostnameOrPanic is the same as FullyQualifiedHostname\n// but panics in case of an error.\nfunc FullyQualifiedHostnameOrPanic() string {\n\thostname, err := FullyQualifiedHostname()\n\tif err != nil {\n\t\tpanic(err)\n\t}","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/netutil/netutil.go#L69-L105","documentation":"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.","triggerScenarios":"net.LookupAddr(localIP) returns zero names during FullyQualifiedHostname execution (backup, tablet registration, listening URL population).","commonSituations":"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.","solutions":["Add a /etc/hosts reverse mapping for the machine's IP with the FQDN first","Fix the DNS zone so a PTR record exists for the IP","Check /etc/nsswitch.conf for resolver modules that swallow results","Pass the hostname explicitly to Vitess rather than deriving it"],"exampleFix":"// /etc/hosts, before\n10.0.0.5\n// after\n10.0.0.5 tablet-1.example.com tablet-1","handlingStrategy":"fallback","validationCode":"ip, _ := net.LookupHost(os.Hostname())\nif len(ip) > 0 {\n    names, err := net.LookupAddr(ip[0])\n    if err != nil || len(names) == 0 {\n        return fmt.Errorf(\"no reverse names for %s\", ip[0])\n    }\n}","typeGuard":null,"tryCatchPattern":"fqdn, err := netutil.FullyQualifiedHostname()\nif err != nil {\n    fqdn = cfg.ExplicitHostname // fall back to configured hostname\n}","preventionTips":["Ensure /etc/hosts lines list the FQDN first: \"IP fqdn shortname\"","Configure DNS zones with PTR records for all nodes","Use explicit hostname configuration in environments without reverse DNS"],"tags":["network","dns","reverse-lookup"],"backgroundTag":"reverse-dns-lookup-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}