{"record":{"id":"925b723fdae4dde4","repo":"thanos-io/thanos","slug":"invalid-lookup-scheme-q","errorCode":null,"errorMessage":"invalid lookup scheme %q","messagePattern":"invalid lookup scheme %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/discovery/dns/resolver.go","lineNumber":162,"sourceCode":"\t\t\taddrs, err := s.resolver.LookupIPAddrByNetwork(ctx, network, host)\n\t\t\tif err != nil {\n\t\t\t\tif !s.resolver.IsNotFound(err) {\n\t\t\t\t\tlookupErrs.Add(err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tips = append(ips, addrs...)\n\t\t}\n\n\t\tif err := lookupErrs.Err(); len(ips) == 0 && err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"lookup IP addresses (dual-stack) %q\", host)\n\t\t}\n\n\t\tfor _, ip := range ips {\n\t\t\tres = append(res, appendScheme(scheme, net.JoinHostPort(ip.String(), port)))\n\t\t}\n\tdefault:\n\t\treturn nil, errors.Errorf(\"invalid lookup scheme %q\", qtype)\n\t}\n\n\tif res == nil && err == nil {\n\t\tlevel.Warn(s.logger).Log(\"msg\", \"IP address lookup yielded no results. No host found or no addresses found\", \"host\", host)\n\t}\n\n\treturn res, nil\n}\n\nfunc appendScheme(scheme, host string) string {\n\tif scheme == \"\" {\n\t\treturn host\n\t}\n\treturn scheme + \"//\" + host\n}\n","sourceCodeStart":144,"sourceCodeEnd":178,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/discovery/dns/resolver.go#L144-L178","documentation":"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.","triggerScenarios":"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+...'.","commonSituations":"Copy-pasted discovery configs between projects with different scheme vocabularies; typos in dns_sd scheme strings; version changes where a scheme name differs.","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."],"exampleFix":"// before\nresolver.Resolve(ctx, []string{\"dnssrvplus+http://headless-svc:9090\"})\n// after\nresolver.Resolve(ctx, []string{\"dnssrv+http://headless-svc:9090\"})","handlingStrategy":"validation","validationCode":"var validSchemes = map[string]bool{\"A\": true, \"SRV\": true, \"ADualStack\": true}\nfunc schemeSupported(qtype string) error {\n    if !validSchemes[qtype] {\n        return fmt.Errorf(\"unsupported lookup scheme %q; use A, SRV, or ADualStack\", qtype)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"res, err := resolver.Resolve(ctx, addrs)\nif err != nil && strings.Contains(err.Error(), \"invalid lookup scheme\") {\n    return fmt.Errorf(\"config error: fix the dns sd scheme in %v\", addrs)\n}","preventionTips":["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."],"tags":["dns","service-discovery","invalid-argument","configuration"],"backgroundTag":"invalid-enum-value","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"}