nsqio/nsq · error
--nsqd-http-address or --lookupd-http-address required
Error message
--nsqd-http-address or --lookupd-http-address required
What it means
nsqadmin.New refuses to construct an instance when both opts.NSQDHTTPAddresses and opts.NSQLookupdHTTPAddresses are empty. nsqadmin needs at least one discovery source to render topics, nodes and channels; without it, every page would be blank, so startup fails with this error before the HTTP listener starts.
Source
Thrown at nsqadmin/nsqadmin.go:45
httpListener net.Listener
waitGroup util.WaitGroupWrapper
notifications chan *AdminAction
graphiteURL *url.URL
httpClientTLSConfig *tls.Config
}
func New(opts *Options) (*NSQAdmin, error) {
if opts.Logger == nil {
opts.Logger = log.New(os.Stderr, opts.LogPrefix, log.Ldate|log.Ltime|log.Lmicroseconds)
}
n := &NSQAdmin{
notifications: make(chan *AdminAction),
}
n.swapOpts(opts)
if len(opts.NSQDHTTPAddresses) == 0 && len(opts.NSQLookupdHTTPAddresses) == 0 {
return nil, errors.New("--nsqd-http-address or --lookupd-http-address required")
}
if len(opts.NSQDHTTPAddresses) != 0 && len(opts.NSQLookupdHTTPAddresses) != 0 {
return nil, errors.New("use --nsqd-http-address or --lookupd-http-address not both")
}
if opts.HTTPClientTLSCert != "" && opts.HTTPClientTLSKey == "" {
return nil, errors.New("--http-client-tls-key must be specified with --http-client-tls-cert")
}
if opts.HTTPClientTLSKey != "" && opts.HTTPClientTLSCert == "" {
return nil, errors.New("--http-client-tls-cert must be specified with --http-client-tls-key")
}
n.httpClientTLSConfig = &tls.Config{
InsecureSkipVerify: opts.HTTPClientTLSInsecureSkipVerify,
}
if opts.HTTPClientTLSCert != "" && opts.HTTPClientTLSKey != "" {View on GitHub (pinned to 85cf10c09c)
Solutions
- Pass at least one address: --lookupd-http-address=127.0.0.1:4161 (most common, gives cluster-wide view) or --nsqd-http-address=127.0.0.1:4151.
- If flags come from a config file, verify the array is populated and the file is actually loaded.
- Check that early flag-processing/validation did not swallow the flags before New() was called.
Example fix
# before nsqadmin --http-address=0.0.0.0:4171 # after nsqadmin --http-address=0.0.0.0:4171 --lookupd-http-address=127.0.0.1:4161
Defensive patterns
Strategy: validation
Validate before calling
if len(opts.NSQDHTTPAddresses) == 0 && len(opts.NSQLookupdHTTPAddresses) == 0 {
return nil, errors.New("nsqadmin: configure --nsqd-http-address or --lookupd-http-address before New()")
}
admin, err := nsqadmin.New(opts) Prevention
- Fail fast in deployment scripts: assert at least one address flag is non-empty before exec'ing nsqadmin.
- Prefer lookupd addresses in clustered setups so the config stays valid as nodes come and go.
When it happens
Trigger: Launching nsqadmin with neither --nsqd-http-address nor --lookupd-http-address (e.g. relying on defaults or a config file section that was dropped). In apps/nsq_stat-style tools the equivalent check log.Fatal's at startup; in library use, New() returns nil and the error.
Common situations: Config-file migration where the addresses array was renamed or not carried over; running nsqadmin in a container with the flags omitted from the command line; misconfigured environment-specific overrides that yield empty lists.
Related errors
- use --nsqd-http-address or --lookupd-http-address not both
- address should not contain scheme
- --http-client-tls-key must be specified with --http-client-t
- --http-client-tls-cert must be specified with --http-client-
- missing <REV> in --filename-format when gzip, rotation, or w
AI-assisted analysis of nsqio/nsq@85cf10c09c (2026-08-16).
Data as JSON: /api/errors/6c0c1b49ca54c207.
Report an issue: GitHub.