siyuan-note/siyuan · error

host has no IP address:

Error message

host has no IP address: 

What it means

After a successful DNS lookup, resolvePublicTarget checks whether any IP addresses were returned. An empty list means the resolver answered but produced no usable addresses, so dialing is impossible and the error 'host has no IP address' is thrown. This prevents silent empty-address dial failures later.

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 8641553a1f)

Solutions

  1. Add A/AAAA records for the hostname in DNS, or point the request at an IP-backed public hostname
  2. Confirm with `dig <host> A` and `dig <host> AAAA` that at least one record exists
  3. Check whether the local resolver filters records (security software, DNS filtering)
  4. Correct typos — a valid-but-recordless name is often a misspelling

Example fix

// before
"https://api.internal.example.net"  // no A record
// after
"https://api.example.com"            // resolvable public host
Defensive patterns

Strategy: validation

Validate before calling

if len(ips) == 0 {
    return fmt.Errorf("host %q resolves to no IP addresses", host)
}

Type guard

func hasIPAddress(host string) bool {
    ips, err := net.LookupIP(host)
    return err == nil && len(ips) > 0
}

Prevention

When it happens

Trigger: lookupIPAddr returns zero IPs for the host — e.g. a hostname with only records the resolver filtered out, or an empty/edge-case host string that parses but has no addresses.

Common situations: DNS zone missing A/AAAA records for a name that exists (CNAME-only misconfig); hosts file entries removed; freshly registered domain with no records; IPv6-only resolver returning no AAAA while IPv4 unavailable.

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@8641553a1f (2026-09-11). Data as JSON: /api/errors/321c5c3b77a1da4f. Report an issue: GitHub.