{"record":{"id":"6b93dfdc59404730","repo":"nsqio/nsq","slug":"failed-to-resolve-nsqd-http-address-s-s","errorCode":null,"errorMessage":"failed to resolve --nsqd-http-address (%s) - %s","messagePattern":"failed to resolve --nsqd-http-address \\((.+?)\\) - (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nsqadmin/nsqadmin.go","lineNumber":94,"sourceCode":"\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\n\tif opts.AllowConfigFromCIDR != \"\" {\n\t\t_, _, err := net.ParseCIDR(opts.AllowConfigFromCIDR)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse --allow-config-from-cidr (%s) - %s\", opts.AllowConfigFromCIDR, err)\n\t\t}\n\t}\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/nsqadmin/nsqadmin.go#L76-L112","documentation":"Mirroring the lookupd check, nsqadmin validates every --nsqd-http-address with net.ResolveTCPAddr before serving (nsqadmin.go); failure aborts startup with 'failed to resolve --nsqd-http-address (%s) - %s'. Use this mode instead of lookupd mode only when you deliberately enumerate nsqd nodes directly; each address must be a resolvable host with a numeric TCP port (nsqd HTTP default 4151, not the TCP 4150).","triggerScenarios":"A --nsqd-http-address entry lacking host:port form, containing a scheme prefix ('http://...'), a non-numeric port, an unresolvable hostname from nsqadmin's vantage point, or copied TCP-port values with the right hostname but intended for a different check. Only the first bad address is reported — fix and re-run if more remain.","commonSituations":"Browser-copied URLs with http:// pasted into the flag; short-lived cloud hostnames that expired before nsqadmin (re)start; mixed environments where nsqd runs in Docker with a bridge IP that changed; typos like 4150 (nsqd's TCP port) instead of 4151.","solutions":["Verify each entry from the nsqadmin host: 'getent hosts <host>' and 'nc -vz <host> 4151'.","Normalize entries to host:port, numeric port 4151 (or your custom HTTP port), no scheme, no path.","Pin stable DNS/IPs for nsqd nodes, or prefer --lookupd-http-address mode so discovery is dynamic.","Re-run nsqadmin; repeat if another address in the list is flagged next."],"exampleFix":"# before\nnsqadmin --nsqd-http-address=nsqd1:4150\n# failed to resolve --nsqd-http-address (nsqd1:4150) - ...  (4150 is the TCP port; also catches http:// prefixes)\n\n# after\nnsqadmin --nsqd-http-address=nsqd1:4151 --nsqd-http-address=nsqd2:4151","handlingStrategy":"validation","validationCode":"for _, a := range nsqdAddrs {\n    if _, err := net.ResolveTCPAddr(\"tcp\", a); err != nil {\n        return fmt.Errorf(\"bad --nsqd-http-address %q: %w (want host:4151)\", a, err)\n    }\n}","typeGuard":"func isHostPort(s string) bool {\n    _, err := net.ResolveTCPAddr(\"tcp\", s)\n    return err == nil\n}","tryCatchPattern":"if err := runNsqadmin(args); err != nil && strings.Contains(err.Error(), \"failed to resolve --nsqd-http-address\") {\n    return errors.New(\"check each entry is host:port (HTTP 4151), no http:// prefix; verify DNS from this host\")\n}","preventionTips":["Remember 4151 = nsqd HTTP, 4150 = nsqd TCP; validate ports in config lint.","Keep a stable DNS name per nsqd node for admin tooling.","Re-run validation whenever node IPs change in dynamic environments."],"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"}