nsqio/nsq · error
failed to query any nsqd: %s
Error message
failed to query any nsqd: %s
What it means
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.
Source
Thrown at internal/clusterinfo/data.go:331
err := c.client.GETV1(endpoint, &resp)
if err != nil {
lock.Lock()
errs = append(errs, err)
lock.Unlock()
return
}
lock.Lock()
defer lock.Unlock()
for _, topic := range resp.Topics {
topics = stringy.Add(topics, topic.Name)
}
}(addr)
}
wg.Wait()
if len(errs) == len(nsqdHTTPAddrs) {
return nil, fmt.Errorf("failed to query any nsqd: %s", ErrList(errs))
}
sort.Strings(topics)
if len(errs) > 0 {
return topics, ErrList(errs)
}
return topics, nil
}
// GetNSQDProducers returns Producers of all the given nsqd
func (c *ClusterInfo) GetNSQDProducers(nsqdHTTPAddrs []string) (Producers, error) {
var producers Producers
var lock sync.Mutex
var wg sync.WaitGroup
var errs []error
type infoRespType struct {View on GitHub (pinned to 85cf10c09c)
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
Example fix
# before --nsqd-http-address=10.0.0.1:4150 # TCP port, wrong # after --nsqd-http-address=10.0.0.1:4151
Defensive patterns
Strategy: retry
Validate before calling
for _, a := range nsqdAddrs {
resp, err := http.Get("http://" + a + "/stats")
if err != nil { log.Printf("nsqd %s down", a); continue }
resp.Body.Close()
} Try / catch
topics, err := ci.GetNSQDTopics(addrs)
if err != nil && strings.Contains(err.Error(), "failed to query any nsqd") {
// all direct nsqd queries failed: check ports/health, then retry with backoff
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to query any nsqlookupd: %s
- http.Serve() error - %s
- listen (%s) failed - %s
- MISSING_ARG_TOPIC
- INVALID_ARG_TOPIC
AI-assisted analysis of nsqio/nsq@85cf10c09c (2026-08-16).
Data as JSON: /api/errors/fb799ce0b83f5d67.
Report an issue: GitHub.