owasp-amass/amass · error

failed to obtain the Public DNS csv file at %s: %v

Error message

failed to obtain the Public DNS csv file at %s: %v

What it means

GetPublicDNSResolvers downloads the public-dns.info nameservers CSV to populate PublicResolvers. If the HTTP request fails or the status code is outside 200-399, it returns this error wrapping the cause (which is nil when a non-2xx/3xx status alone triggered it).

Source

Thrown at config/resolvers.go:60

	"76.76.19.19",    // Alternate DNS
	"37.235.1.177",   // FreeDNS
	"77.88.8.1",      // Yandex.DNS
	"94.140.14.140",  // AdGuard
	"38.132.106.139", // CyberGhost
	"74.82.42.42",    // Hurricane Electric
	"76.76.2.0",      // ControlD
}

// PublicResolvers includes the addresses of public resolvers obtained dynamically.
var PublicResolvers []string

// GetPublicDNSResolvers obtains the public DNS server addresses from public-dns.info and assigns them to PublicResolvers.
func GetPublicDNSResolvers() error {
	url := "https://public-dns.info/nameservers-all.csv"
	resp, err := amasshttp.RequestWebPage(context.Background(),
		amasshttp.DefaultClient, &amasshttp.Request{URL: url})
	if err != nil || resp.StatusCode < 200 || resp.StatusCode >= 400 {
		return fmt.Errorf("failed to obtain the Public DNS csv file at %s: %v", url, err)
	}

	var resolvers []string
	var ipIdx, reliabilityIdx int
	r := csv.NewReader(strings.NewReader(resp.Body))
	for i := 0; ; i++ {
		record, err := r.Read()
		if err == io.EOF {
			break
		}
		if err != nil {
			continue
		}
		if i == 0 {
			for idx, val := range record {
				switch val {
				case "ip_address":
					ipIdx = idx

View on GitHub (pinned to 79299dce87)

Solutions

  1. Check network connectivity to the URL: curl -I https://public-dns.info/nameservers-all.csv.
  2. Configure proxy environment variables (HTTP_PROXY/HTTPS_PROXY) if behind a proxy, or use a VPN.
  3. Retry later if public-dns.info is temporarily unavailable; the error includes the wrapped cause for diagnosis.
  4. Configure resolvers manually in the config file instead of relying on the public list.
  5. Check resp.StatusCode in your own wrapper if you embed this — the %v is nil for pure HTTP-status failures.
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head("https://public-dns.info/nameservers-all.csv")
if err != nil || resp.StatusCode >= 400 {
    log.Println("public-dns.info unreachable; using local resolver config")
}

Try / catch

if err := config.GetPublicDNSResolvers(); err != nil {
    log.Printf("public resolvers unavailable, falling back to config: %v", err)
    // proceed with configured resolvers
}

Prevention

When it happens

Trigger: Calling GetPublicDNSResolvers when https://public-dns.info/nameservers-all.csv is unreachable, returns 4xx/5xx, the network is down, or DNS/TLS for that host fails.

Common situations: No internet access or behind a corporate proxy; public-dns.info is down or rate-limits; TLS interception in a sandboxed CI environment; offline runs that should use local resolver config instead.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/cdb4b543db67f89b. Report an issue: GitHub.