{"record":{"id":"ffd7918dbc7d7006","repo":"thanos-io/thanos","slug":"address-s-is-not-of-host-port-format-or-a-val","errorCode":null,"errorMessage":"Address %s is not of <host>:<port> format or a valid DNS query.","messagePattern":"Address (.+?) is not of <host>:<port> format or a valid DNS query\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/extkingpin/flags.go","lineNumber":60,"sourceCode":"}\n\nfunc Addrs(flags *kingpin.FlagClause) (target *addressSlice) {\n\ttarget = &addressSlice{}\n\tflags.SetValue((*addressSlice)(target))\n\treturn\n}\n\n// validateAddrs checks an address slice for empty or invalid elements.\nfunc validateAddrs(addrs addressSlice) error {\n\tfor _, addr := range addrs {\n\t\tif addr == \"\" {\n\t\t\treturn errors.New(\"Address is empty.\")\n\t\t}\n\n\t\tqtypeAndName := strings.SplitN(addr, \"+\", 2)\n\t\thostAndPort := strings.SplitN(addr, \":\", 2)\n\t\tif len(qtypeAndName) != 2 && len(hostAndPort) != 2 {\n\t\t\treturn errors.Errorf(\"Address %s is not of <host>:<port> format or a valid DNS query.\", addr)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// RegisterHTTPFlags register flags commonly used to configure http servers with.\nfunc RegisterHTTPFlags(cmd FlagClause) (httpBindAddr *string, httpGracePeriod *model.Duration, httpTLSConfig *string) {\n\thttpBindAddr = cmd.Flag(\"http-address\", \"Listen host:port for HTTP endpoints.\").Default(\"0.0.0.0:10902\").String()\n\thttpGracePeriod = ModelDuration(cmd.Flag(\"http-grace-period\", \"Time to wait after an interrupt received for HTTP Server.\").Default(\"2m\")) // by default it's the same as query.timeout.\n\thttpTLSConfig = cmd.Flag(\n\t\t\"http.config\",\n\t\t\"[EXPERIMENTAL] Path to the configuration file that can enable TLS or authentication for all HTTP endpoints.\",\n\t).Default(\"\").String()\n\treturn httpBindAddr, httpGracePeriod, httpTLSConfig\n}\n\n// RegisterCommonObjStoreFlags register flags to specify object storage configuration.","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/extkingpin/flags.go#L42-L78","documentation":"validateAddrs checks that every address passed to a DNS-resolving flag is either a <host>:<port> pair or a DNS query of the form <qtype>+<name>. If an address splits into neither a host:port (no colon) nor a qtype+name (no plus), this error is thrown. It is a client-side validation performed before the address is ever used.","triggerScenarios":"Calling Set (via flags like --store, --sidecars, --ruler, --query) with an address lacking both ':' and '+' separators, e.g. 'thanos-store' without a port, or 'localhost:9090+dnssrv' malformed so SplitN yields only one part.","commonSituations":"Copy-pasting a service name without its port from Kubernetes docs; forgetting the port on a store address; hand-typing a DNS SRV query and omitting the '+' between qtype and name.","solutions":["Append the port to the address, e.g. 'thanos-store:9090'.","For SRV lookups use the '<qtype>+<name>' form, e.g. '_grpc._tcp.thanos-store.example.com' prefixed like 'dnssrv+_grpc._tcp.myservice'.","Verify the flag value contains either a ':' (host:port) or a '+' (DNS query) before starting Thanos."],"exampleFix":"// before\n--store=dnssrv+_http._tcp.thanos-store\n// after\n--store=dnssrv+_grpc._tcp.thanos-store:9090","handlingStrategy":"validation","validationCode":"func validAddr(a string) bool { return strings.Contains(a, \":\") || strings.Contains(a, \"+\") }\nif !validAddr(addr) { return fmt.Errorf(\"bad address %q\", addr) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a port with peer addresses","Use the dnssrv+ prefix form for SRV queries","Lint flag values in deployment tooling before launch"],"tags":["cli","validation","address-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}