{"record":{"id":"2ccdbb2c2a09bf74","repo":"thanos-io/thanos","slug":"recursively-resolve-s","errorCode":null,"errorMessage":"recursively resolve %s","messagePattern":"recursively resolve (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/discovery/dns/miekgdns/resolver.go","lineNumber":56,"sourceCode":"\tresponse, err := r.lookupWithSearchPath(target, dns.Type(dns.TypeSRV))\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tfor _, record := range response.Answer {\n\t\tswitch addr := record.(type) {\n\t\tcase *dns.SRV:\n\t\t\taddrs = append(addrs, &net.SRV{\n\t\t\t\tWeight:   addr.Weight,\n\t\t\t\tTarget:   addr.Target,\n\t\t\t\tPriority: addr.Priority,\n\t\t\t\tPort:     addr.Port,\n\t\t\t})\n\t\tcase *dns.CNAME:\n\t\t\t// Recursively resolve it.\n\t\t\t_, resp, err := r.lookupSRV(\"\", \"\", addr.Target, currIteration+1, maxIterations)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", nil, errors.Wrapf(err, \"recursively resolve %s\", addr.Target)\n\t\t\t}\n\t\t\taddrs = append(addrs, resp...)\n\t\tdefault:\n\t\t\treturn \"\", nil, errors.Errorf(\"invalid SRV response record %s\", record)\n\t\t}\n\t}\n\n\treturn \"\", addrs, nil\n}\n\nfunc (r *Resolver) LookupIPAddr(_ context.Context, host string) ([]net.IPAddr, error) {\n\treturn r.lookupIPAddr(host, 1, 8)\n}\n\nfunc (r *Resolver) LookupIPAddrByNetwork(ctx context.Context, network, host string) ([]net.IPAddr, error) {\n\tvar qtype dns.Type\n\tswitch network {\n\tcase \"ip6\":","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/discovery/dns/miekgdns/resolver.go#L38-L74","documentation":"Wraps an error from the recursive lookupSRV call made when an answer record is a CNAME instead of a SRV: the resolver re-resolves addr.Target with empty service/proto and, if that nested lookup fails, attaches 'recursively resolve <target>' context to the underlying error (which may itself be error 567, 562, etc.).","triggerScenarios":"A SRV query answer contains a *dns.CNAME whose Target fails to resolve recursively — NXDOMAIN, server errors, or iteration limit exceeded on the nested call.","commonSituations":"Dangling CNAMEs pointing at deleted services; CNAME chains that exceed the recursion cap; the target name only resolving in certain search domains.","solutions":["Inspect the nested root cause after 'recursively resolve <target>:' in the message to pick the right fix","Verify the CNAME target exists: dig SRV <target>","Remove or update the dangling/looping CNAME record in your DNS zone","Ensure the target's zone/search domain is correctly configured for your resolver"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify the SRV target resolves before discovery\nans, err := lookupSRVManually(target); if err != nil { /* dangling CNAME; fix DNS */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"recursively resolve\") {\n    logger.Warn(\"SRV answer contained unresolvable CNAME\", \"err\", err)\n    return usePartialResultsOrSkip()\n}","preventionTips":["Ensure CNAME targets referenced by SRV answers always exist in DNS","Clean up CNAMEs when deleting services they point to","Use fully-qualified CNAME targets resolvable in the configured search domains","Monitor for dangling CNAMEs with periodic DNS audits"],"tags":["dns","srv","cname","recursion"],"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"}