{"record":{"id":"fb799ce0b83f5d67","repo":"nsqio/nsq","slug":"failed-to-query-any-nsqd-s","errorCode":null,"errorMessage":"failed to query any nsqd: %s","messagePattern":"failed to query any nsqd: (.+?)","errorType":"http","errorClass":null,"httpStatus":502,"severity":"error","filePath":"internal/clusterinfo/data.go","lineNumber":331,"sourceCode":"\t\t\terr := c.client.GETV1(endpoint, &resp)\n\t\t\tif err != nil {\n\t\t\t\tlock.Lock()\n\t\t\t\terrs = append(errs, err)\n\t\t\t\tlock.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlock.Lock()\n\t\t\tdefer lock.Unlock()\n\t\t\tfor _, topic := range resp.Topics {\n\t\t\t\ttopics = stringy.Add(topics, topic.Name)\n\t\t\t}\n\t\t}(addr)\n\t}\n\twg.Wait()\n\n\tif len(errs) == len(nsqdHTTPAddrs) {\n\t\treturn nil, fmt.Errorf(\"failed to query any nsqd: %s\", ErrList(errs))\n\t}\n\n\tsort.Strings(topics)\n\n\tif len(errs) > 0 {\n\t\treturn topics, ErrList(errs)\n\t}\n\treturn topics, nil\n}\n\n// GetNSQDProducers returns Producers of all the given nsqd\nfunc (c *ClusterInfo) GetNSQDProducers(nsqdHTTPAddrs []string) (Producers, error) {\n\tvar producers Producers\n\tvar lock sync.Mutex\n\tvar wg sync.WaitGroup\n\tvar errs []error\n\n\ttype infoRespType struct {","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/internal/clusterinfo/data.go#L313-L349","documentation":"ClusterInfo.GetNSQDTopics queries the given nsqd nodes directly (their /stats endpoint topic section), unioning topic names. It fails with this message only when every nsqd request errored; partial failures return the union plus an ErrList. nsqadmin hits this path when run with --nsqd-http-address instead of --lookupd-http-address.","triggerScenarios":"Every address in --nsqd-http-address failing: nsqd processes down, wrong host/port (HTTP port is 4151, not the TCP 4150), firewall blocks, or invalid addresses that fail before the request.","commonSituations":"Confusing the TCP (4150) and HTTP (4151) nsqd ports in the flag; pointing nsqadmin at a dead node list; container network segmentation blocking the admin UI from nsqd; all nsqd restarted on different ports.","solutions":["Test one node: curl http://<nsqd>:4151/stats","Use the HTTP port 4151 in --nsqd-http-address (not 4150)","Restart nsqd or fix its --http-address binding if it listens elsewhere","Prefer --lookupd-http-address for dynamic clusters so the list stays current"],"exampleFix":"# before\n--nsqd-http-address=10.0.0.1:4150   # TCP port, wrong\n\n# after\n--nsqd-http-address=10.0.0.1:4151","handlingStrategy":"retry","validationCode":"for _, a := range nsqdAddrs {\n\tresp, err := http.Get(\"http://\" + a + \"/stats\")\n\tif err != nil { log.Printf(\"nsqd %s down\", a); continue }\n\tresp.Body.Close()\n}","typeGuard":null,"tryCatchPattern":"topics, err := ci.GetNSQDTopics(addrs)\nif err != nil && strings.Contains(err.Error(), \"failed to query any nsqd\") {\n\t// all direct nsqd queries failed: check ports/health, then retry with backoff\n}","preventionTips":["Always use the HTTP port 4151 in --nsqd-http-address","Prefer lookupd-based discovery unless you run a fixed single nsqd","Health-check direct nsqd addresses from the admin host before depending on them"],"tags":["clusterinfo","nsqd","network","http","discovery"],"backgroundTag":null,"analyzedSha":"85cf10c09c6c3c86160d6f0eb156f62d0efc1648","analyzedAt":"2026-08-16T00:53:05.009Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}