{"record":{"id":"21fcf375e24ea4bb","repo":"thanos-io/thanos","slug":"could-not-resolve-q-all-servers-responded-with-e","errorCode":null,"errorMessage":"could not resolve %q: all servers responded with errors to at least one search domain. Errs %s","messagePattern":"could not resolve %q: all servers responded with errors to at least one search domain\\. Errs (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/discovery/dns/miekgdns/lookup.go","lineNumber":76,"sourceCode":"\t\t\t// we can no longer say \"this name definitely doesn't\n\t\t\t// exist\", because we did not get that answer for\n\t\t\t// at least one name.\n\t\t\terrs = append(errs, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif response.Rcode == dns.RcodeSuccess {\n\t\t\t// Outcome 1: GOLD!\n\t\t\treturn response, nil\n\t\t}\n\t}\n\n\tif len(errs) == 0 {\n\t\t// Outcome 2: everyone says NXDOMAIN.\n\t\treturn &dns.Msg{}, ErrNoSuchHost\n\t}\n\t// Outcome 3: boned.\n\treturn nil, errors.Errorf(\"could not resolve %q: all servers responded with errors to at least one search domain. Errs %s\", name, fmtErrs(errs))\n}\n\n// lookupFromAnyServer uses all configured servers to try and resolve a specific\n// name.  If a viable answer is received from a server, then it is\n// immediately returned, otherwise the other servers in the config are\n// tried, and if none of them return a viable answer, an error is returned.\n//\n// A \"viable answer\" is one which indicates either:\n//\n//  1. \"yes, I know that name, and here are its records of the requested type\"\n//     (RCODE==SUCCESS, ANCOUNT > 0);\n//  2. \"yes, I know that name, but it has no records of the requested type\"\n//     (RCODE==SUCCESS, ANCOUNT==0); or\n//  3. \"I know that name doesn't exist\" (RCODE==NXDOMAIN).\n//\n// A non-viable answer is \"anything else\", which encompasses both various\n// system-level problems (like network timeouts) and also\n// valid-but-unexpected DNS responses (SERVFAIL, REFUSED, etc).","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/discovery/dns/miekgdns/lookup.go#L58-L94","documentation":"Returned by lookupWithSearchPath when at least one queried DNS server responded with an actual error (not NXDOMAIN) for every name permutation tried — i.e. the resolution failed for infrastructural reasons rather than 'host not found'. The message aggregates all underlying per-server errors via fmtErrs for diagnosis.","triggerScenarios":"All servers in resolv.conf either time out, refuse connections, or return failure rcodes for every search-path variant of the name, leaving errs non-empty in lookupWithSearchPath.","commonSituations":"DNS server IP in resolv.conf is stale/unreachable (VPN down, cluster DNS pod down); firewall blocking UDP/TCP 53; resolv.conf pointing at a resolver that drops queries; ndots/search-path churn amplifying failures.","solutions":["Read the aggregated 'Errs ...' tail of the message to see the per-server root causes","Check reachability of the nameservers in resolv.conf: dig @<server> <name> for each one","Restore connectivity to the DNS servers (VPN, firewall rules, CoreDNS/kube-dns health)","Verify the search domains and the queried name are correct; retry once connectivity is restored"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check the configured nameservers respond\nfor _, ns := range nameserversFromResolvConf() {\n    if err := probeDNS(ns); err != nil { /* surface unreachable server early */ }\n}","typeGuard":null,"tryCatchPattern":"resp, err := r.LookupSRV(ctx, svc, proto, name)\nif err != nil {\n    if strings.Contains(err.Error(), \"all servers responded with errors\") {\n        return retry.Do(func() error { return resolveAgain() }, retry.Attempts(3), retry.Delay(2*time.Second))\n    }\n    return err\n}","preventionTips":["Keep resolv.conf nameserver entries current and reachable from the pod/network","Alert on DNS server health (CoreDNS/kube-dns availability) before discovery breaks","Allow UDP and TCP 53 through firewalls/network policies to your resolvers","Log the aggregated Errs tail and route it to your DNS troubleshooting runbook"],"tags":["dns","network","dns-server-unreachable"],"backgroundTag":"dns-resolution-failed","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"}