{"record":{"id":"26551c02b151ae90","repo":"nsqio/nsq","slug":"failed-to-resolve-lookupd-http-address-s-s","errorCode":null,"errorMessage":"failed to resolve --lookupd-http-address (%s) - %s","messagePattern":"failed to resolve --lookupd-http-address \\((.+?)\\) - (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nsqadmin/nsqadmin.go","lineNumber":87,"sourceCode":"\t\tn.httpClientTLSConfig.Certificates = []tls.Certificate{cert}\n\t}\n\tif opts.HTTPClientTLSRootCAFile != \"\" {\n\t\ttlsCertPool := x509.NewCertPool()\n\t\tcaCertFile, err := os.ReadFile(opts.HTTPClientTLSRootCAFile)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read TLS root CA file %s - %s\",\n\t\t\t\topts.HTTPClientTLSRootCAFile, err)\n\t\t}\n\t\tif !tlsCertPool.AppendCertsFromPEM(caCertFile) {\n\t\t\treturn nil, fmt.Errorf(\"failed to AppendCertsFromPEM %s\", opts.HTTPClientTLSRootCAFile)\n\t\t}\n\t\tn.httpClientTLSConfig.RootCAs = tlsCertPool\n\t}\n\n\tfor _, address := range opts.NSQLookupdHTTPAddresses {\n\t\t_, err := net.ResolveTCPAddr(\"tcp\", address)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to resolve --lookupd-http-address (%s) - %s\", address, err)\n\t\t}\n\t}\n\n\tfor _, address := range opts.NSQDHTTPAddresses {\n\t\t_, err := net.ResolveTCPAddr(\"tcp\", address)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to resolve --nsqd-http-address (%s) - %s\", address, err)\n\t\t}\n\t}\n\n\tif opts.ProxyGraphite {\n\t\turl, err := url.Parse(opts.GraphiteURL)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse --graphite-url (%s) - %s\", opts.GraphiteURL, err)\n\t\t}\n\t\tn.graphiteURL = url\n\t}\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/nsqadmin/nsqadmin.go#L69-L105","documentation":"At startup nsqadmin validates every address in --lookupd-http-address by calling net.ResolveTCPAddr on it (nsqadmin.go). If resolution fails — malformed host:port, unknown hostname, bad port literal — New aborts with 'failed to resolve --lookupd-http-address (%s) - %s' echoing the offending address and the resolver error. This is a pre-flight check: it catches typos and DNS problems before the web UI starts making requests.","triggerScenarios":"Passing an address without a port ('lookupd' alone fails; the form must be host:port), a non-numeric port ('nsqlookupd:http'), a hostname not resolvable from the nsqadmin host, or stray whitespace/scheme prefixes like 'http://host:4161' (the scheme is not part of a TCP address and ResolveTCPAddr rejects it).","commonSituations":"DNS entries existing in one environment but not where nsqadmin runs (k8s service names outside the cluster, split-horizon DNS); compose service names used on bare metal; copy-paste from browser URLs leaving 'http://' on the address; IPv6 addresses written without brackets.","solutions":["Test from the nsqadmin host: 'nc -vz host 4161' or 'getent hosts host' — resolve the name or fix the typo.","Use plain host:port with no scheme and a numeric port (default lookupd HTTP port is 4161), e.g. --lookupd-http-address=10.0.0.2:4161.","For container DNS issues, use the service IP/FQDN or fix the resolver; for IPv6 write [::1]:4161.","Restart nsqadmin once every listed address resolves."],"exampleFix":"# before\nnsqadmin --lookupd-http-address=http://lookupd:4161\n# failed to resolve --lookupd-http-address (http://lookupd:4161) - address http://lookupd:4161: too many colons\n\n# after\nnsqadmin --lookupd-http-address=lookupd.internal:4161\ngetent hosts lookupd.internal   # verify DNS from the nsqadmin host first","handlingStrategy":"validation","validationCode":"// pre-start: validate every lookupd address exactly like nsqadmin does\nfor _, a := range lookupdAddrs {\n    if _, err := net.ResolveTCPAddr(\"tcp\", a); err != nil {\n        return fmt.Errorf(\"bad --lookupd-http-address %q: %w (want host:port, no scheme)\", a, err)\n    }\n}","typeGuard":"func isHostPort(s string) bool {\n    _, err := net.ResolveTCPAddr(\"tcp\", s)\n    return err == nil\n}","tryCatchPattern":"// config loaders: surface a hint for the common scheme-prefix mistake\nif err := runNsqadmin(args); err != nil && strings.Contains(err.Error(), \"failed to resolve --lookupd-http-address\") {\n    return errors.New(\"strip http:// and use host:4161 for every lookupd address\")\n}","preventionTips":["Never paste browser URLs into address flags; strip schemes and paths.","Validate addresses from the exact host/network where nsqadmin runs.","Prefer lookupd mode over enumerating nodes when DNS is dynamic."],"tags":["configuration","dns","nsqadmin","startup","address-validation"],"backgroundTag":null,"analyzedSha":"85cf10c09c6c3c86160d6f0eb156f62d0efc1648","analyzedAt":"2026-08-16T00:53:05.009Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}