{"record":{"id":"763164cf0e0c39f5","repo":"nsqio/nsq","slug":"use-nsqd-http-address-or-lookupd-http-address","errorCode":null,"errorMessage":"use --nsqd-http-address or --lookupd-http-address not both","messagePattern":"use --nsqd-http-address or --lookupd-http-address not both","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nsqadmin/nsqadmin.go","lineNumber":49,"sourceCode":"\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 != \"\" {\n\t\tcert, err := tls.LoadX509KeyPair(opts.HTTPClientTLSCert, opts.HTTPClientTLSKey)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to LoadX509KeyPair %s, %s - %s\",\n\t\t\t\topts.HTTPClientTLSCert, opts.HTTPClientTLSKey, err)","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/nsqadmin/nsqadmin.go#L31-L67","documentation":"nsqadmin supports exactly one discovery mode: either a static list of nsqd HTTP addresses (direct mode) or nsqlookupd addresses (cluster discovery). Supplying both is rejected because the two modes imply different topology semantics and merging them would double-report nodes and topics.","triggerScenarios":"Running nsqadmin with both --nsqd-http-address and --lookupd-http-address present (either flag may be repeated; a single instance of each is enough to trigger). The check is len(opts.NSQDHTTPAddresses) != 0 && len(opts.NSQLookupdHTTPAddresses) != 0.","commonSituations":"Incrementally adding lookupd to an existing deployment and leaving the old --nsqd-http-address flag in systemd unit files; copy-pasted command lines from different runbooks; config templates that define both keys by default.","solutions":["In a cluster with nsqlookupd, remove all --nsqd-http-address flags and keep --lookupd-http-address.","For a single nsqd without lookupd, remove all --lookupd-http-address flags.","Search the full command line AND config file: one leftover flag of the other kind is enough to fail."],"exampleFix":"# before\nnsqadmin --nsqd-http-address=10.0.0.1:4151 --lookupd-http-address=10.0.0.2:4161\n# after\nnsqadmin --lookupd-http-address=10.0.0.2:4161","handlingStrategy":"validation","validationCode":"if len(opts.NSQDHTTPAddresses) > 0 && len(opts.NSQLookupdHTTPAddresses) > 0 {\n\treturn nil, errors.New(\"nsqadmin: configure exactly one of nsqd or lookupd HTTP addresses\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode the chosen mode once in a base systemd unit / helm values and forbid overriding with the other flag.","Lint rendered configs for the presence of both flag families in CI."],"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"}