siyuan-note/siyuan · error

host has no IP address:

Error message

host has no IP address: 

What it means

After a successful DNS lookup, the SSRF-safe transport checks that at least one IP address was returned. An empty result with no error is treated as a fatal input problem: the host literally has no usable address, so the request cannot be pinned to a public IP.

Solutions

  1. Confirm the domain has A/AAAA records with dig +short host A / dig +short host AAAA
  2. Fix the DNS record at the authoritative zone or use the correct hostname
  3. Check whether a security appliance/proxy DNS filter is stripping answers
  4. Use a different, valid hostname for the API endpoint

Example fix

// before (subdomain without A record)
HTTPRequest("GET", "https://stale.api.example.com", nil, "")
// after
HTTPRequest("GET", "https://api.example.com", nil, "")
Defensive patterns

Strategy: validation

Validate before calling

ips, _ := net.LookupIP(host)
if len(ips) == 0 {
    return fmt.Errorf("host %s has no A/AAAA records; fix DNS before calling", host)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "has no IP address") {
    return fmt.Errorf("DNS zone for %s has no address records; correct the zone", host)
}

Prevention

When it happens

Trigger: Agent HTTP request through a proxy to a hostname whose DNS response contains zero A/AAAA records (e.g. a name with only CNAME chains ending nowhere, or a DNS64/NAT64 edge configuration returning an empty answer).

Common situations: DNS zone misconfiguration; records recently removed; enterprise resolver returning empty answers for blocked domains; custom resolver injected in tests returning no addresses.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/321c5c3b77a1da4f. Report an issue: GitHub.

Appendix: source

Thrown at kernel/util/httprequest.go:169

			port = "443"
		default:
			return "", errors.New("URL must start with http:// or https://")
		}
	}

	if ip := net.ParseIP(host); ip != nil {
		if isPrivateIP(ip) {
			return "", errors.New("access to private/internal IP is prohibited")
		}
		return net.JoinHostPort(ip.String(), port), nil
	}

	ips, err := t.lookupIPAddr(ctx, host)
	if err != nil {
		return "", errors.New("failed to resolve host: " + err.Error())
	}
	if len(ips) == 0 {
		return "", errors.New("host has no IP address: " + host)
	}
	for _, ipAddr := range ips {
		if isPrivateIP(ipAddr.IP) {
			return "", errors.New("access to private/internal IP is prohibited")
		}
	}
	return net.JoinHostPort(ips[0].IP.String(), port), nil
}

func cloneURL(src *url.URL) *url.URL {
	ret := *src
	return &ret
}

func dialProxyTunnel(ctx context.Context, proxyURL *url.URL, targetAddr string) (net.Conn, *bufio.Reader, error) {
	proxyAddr, err := proxyAddress(proxyURL)
	if err != nil {
		return nil, nil, err

View on GitHub (pinned to 9f775e8a12)