thanos-io/thanos · error
invalid lookup scheme
Error message
invalid lookup scheme %q
What it means
Resolve dispatches on the lookup scheme parsed from the address (A, SRV, ADualStack). Any scheme value outside the supported set falls to the default branch and returns this error, because the resolver has no lookup implementation for it. It is a configuration/naming error, not a DNS failure.
Solutions
- Use one of the supported schemes (A, SRV, or ADualStack) in the address prefix.
- Fix typos in the scheme string (e.g. 'dnssrv' vs 'dns+srv').
- Check the library docs/source for the exact accepted scheme names for the version in use.
Example fix
// before
resolver.Resolve(ctx, []string{"dnssrvplus+http://headless-svc:9090"})
// after
resolver.Resolve(ctx, []string{"dnssrv+http://headless-svc:9090"}) Defensive patterns
Strategy: validation
Validate before calling
var validSchemes = map[string]bool{"A": true, "SRV": true, "ADualStack": true}
func schemeSupported(qtype string) error {
if !validSchemes[qtype] {
return fmt.Errorf("unsupported lookup scheme %q; use A, SRV, or ADualStack", qtype)
}
return nil
} Try / catch
res, err := resolver.Resolve(ctx, addrs)
if err != nil && strings.Contains(err.Error(), "invalid lookup scheme") {
return fmt.Errorf("config error: fix the dns sd scheme in %v", addrs)
} Prevention
- Keep a constant list of allowed scheme strings and build addresses from it.
- Validate discovery configs at load time, before use.
- Copy scheme names only from the library's own docs/tests.
- Add a startup-time check that all configured schemes resolve without error.
When it happens
Trigger: Calling Resolve with an address whose scheme prefix is not one of the supported lookup schemes — e.g. a typo like 'dnssrvplus+http://...' or an unsupported scheme such as 'dnsaaaa+...'.
Common situations: Copy-pasted discovery configs between projects with different scheme vocabularies; typos in dns_sd scheme strings; version changes where a scheme name differs.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- missing port in address given for dnsdualstack lookup
- no such host
- could not load resolv.conf
- unsupported network
- raw resolution must be higher than the minimum block size…
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/925b723fdae4dde4.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/discovery/dns/resolver.go:162
addrs, err := s.resolver.LookupIPAddrByNetwork(ctx, network, host)
if err != nil {
if !s.resolver.IsNotFound(err) {
lookupErrs.Add(err)
}
continue
}
ips = append(ips, addrs...)
}
if err := lookupErrs.Err(); len(ips) == 0 && err != nil {
return nil, errors.Wrapf(err, "lookup IP addresses (dual-stack) %q", host)
}
for _, ip := range ips {
res = append(res, appendScheme(scheme, net.JoinHostPort(ip.String(), port)))
}
default:
return nil, errors.Errorf("invalid lookup scheme %q", qtype)
}
if res == nil && err == nil {
level.Warn(s.logger).Log("msg", "IP address lookup yielded no results. No host found or no addresses found", "host", host)
}
return res, nil
}
func appendScheme(scheme, host string) string {
if scheme == "" {
return host
}
return scheme + "//" + host
}
View on GitHub (pinned to 35b8b99117)