thanos-io/thanos · error
Address is not of : format or a valid DNS query.
Error message
Address %s is not of <host>:<port> format or a valid DNS query.
What it means
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.
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.
Example fix
// before --store=dnssrv+_http._tcp.thanos-store // after --store=dnssrv+_grpc._tcp.thanos-store:9090
Defensive patterns
Strategy: validation
Validate before calling
func validAddr(a string) bool { return strings.Contains(a, ":") || strings.Contains(a, "+") }
if !validAddr(addr) { return fmt.Errorf("bad address %q", addr) } Prevention
- Always include a port with peer addresses
- Use the dnssrv+ prefix form for SRV queries
- Lint flag values in deployment tooling before launch
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
- DNS resolution errors: ENOTFOUND and getaddrinfo failures — how hostname lookups fail and how to debug them.
Related errors
- unsupported format for label
- --auto-gomemlimit.ratio must be greater than 0 and less…
- error validating the config
- --receive.lazy-retrieval-max-buffered-responses must be > 0
- Address is duplicated for --query flag.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/ffd7918dbc7d7006.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/extkingpin/flags.go:60
}
func Addrs(flags *kingpin.FlagClause) (target *addressSlice) {
target = &addressSlice{}
flags.SetValue((*addressSlice)(target))
return
}
// validateAddrs checks an address slice for empty or invalid elements.
func validateAddrs(addrs addressSlice) error {
for _, addr := range addrs {
if addr == "" {
return errors.New("Address is empty.")
}
qtypeAndName := strings.SplitN(addr, "+", 2)
hostAndPort := strings.SplitN(addr, ":", 2)
if len(qtypeAndName) != 2 && len(hostAndPort) != 2 {
return errors.Errorf("Address %s is not of <host>:<port> format or a valid DNS query.", addr)
}
}
return nil
}
// RegisterHTTPFlags register flags commonly used to configure http servers with.
func RegisterHTTPFlags(cmd FlagClause) (httpBindAddr *string, httpGracePeriod *model.Duration, httpTLSConfig *string) {
httpBindAddr = cmd.Flag("http-address", "Listen host:port for HTTP endpoints.").Default("0.0.0.0:10902").String()
httpGracePeriod = 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.
httpTLSConfig = cmd.Flag(
"http.config",
"[EXPERIMENTAL] Path to the configuration file that can enable TLS or authentication for all HTTP endpoints.",
).Default("").String()
return httpBindAddr, httpGracePeriod, httpTLSConfig
}
// RegisterCommonObjStoreFlags register flags to specify object storage configuration.View on GitHub (pinned to 35b8b99117)