{"record":{"id":"6c0c1b49ca54c207","repo":"nsqio/nsq","slug":"nsqd-http-address-or-lookupd-http-address-requ","errorCode":null,"errorMessage":"--nsqd-http-address or --lookupd-http-address required","messagePattern":"--nsqd-http-address or --lookupd-http-address required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nsqadmin/nsqadmin.go","lineNumber":45,"sourceCode":"\thttpListener        net.Listener\n\twaitGroup           util.WaitGroupWrapper\n\tnotifications       chan *AdminAction\n\tgraphiteURL         *url.URL\n\thttpClientTLSConfig *tls.Config\n}\n\nfunc New(opts *Options) (*NSQAdmin, error) {\n\tif opts.Logger == nil {\n\t\topts.Logger = log.New(os.Stderr, opts.LogPrefix, log.Ldate|log.Ltime|log.Lmicroseconds)\n\t}\n\n\tn := &NSQAdmin{\n\t\tnotifications: make(chan *AdminAction),\n\t}\n\tn.swapOpts(opts)\n\n\tif len(opts.NSQDHTTPAddresses) == 0 && len(opts.NSQLookupdHTTPAddresses) == 0 {\n\t\treturn nil, errors.New(\"--nsqd-http-address or --lookupd-http-address required\")\n\t}\n\n\tif len(opts.NSQDHTTPAddresses) != 0 && len(opts.NSQLookupdHTTPAddresses) != 0 {\n\t\treturn nil, errors.New(\"use --nsqd-http-address or --lookupd-http-address not both\")\n\t}\n\n\tif opts.HTTPClientTLSCert != \"\" && opts.HTTPClientTLSKey == \"\" {\n\t\treturn nil, errors.New(\"--http-client-tls-key must be specified with --http-client-tls-cert\")\n\t}\n\n\tif opts.HTTPClientTLSKey != \"\" && opts.HTTPClientTLSCert == \"\" {\n\t\treturn nil, errors.New(\"--http-client-tls-cert must be specified with --http-client-tls-key\")\n\t}\n\n\tn.httpClientTLSConfig = &tls.Config{\n\t\tInsecureSkipVerify: opts.HTTPClientTLSInsecureSkipVerify,\n\t}\n\tif opts.HTTPClientTLSCert != \"\" && opts.HTTPClientTLSKey != \"\" {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/nsqadmin/nsqadmin.go#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nnsqadmin --http-address=0.0.0.0:4171\n# after\nnsqadmin --http-address=0.0.0.0:4171 --lookupd-http-address=127.0.0.1:4161","handlingStrategy":"validation","validationCode":"if len(opts.NSQDHTTPAddresses) == 0 && len(opts.NSQLookupdHTTPAddresses) == 0 {\n\treturn nil, errors.New(\"nsqadmin: configure --nsqd-http-address or --lookupd-http-address before New()\")\n}\nadmin, err := nsqadmin.New(opts)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["nsq","nsqadmin","cli","config","validation"],"backgroundTag":null,"analyzedSha":"85cf10c09c6c3c86160d6f0eb156f62d0efc1648","analyzedAt":"2026-08-16T00:53:05.009Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}