JuliusBrussee/caveman · error
ssrf: host resolved to no addresses
Error message
ssrf: host %q resolved to no addresses
What it means
After a successful LookupIPAddr the library expects at least one address. Some resolver stacks can return success with an empty answer; since the guard must range-check every resolved IP, an empty result is treated as an unreached destination and rejected.
Solutions
- Verify the hostname actually has A/AAAA records (dig A host, dig AAAA host) and re-create them if drained
- Point configuration at a hostname that resolves (or an IP literal, which skips DNS entirely)
- Flush/fix the local resolver if a stale empty answer is cached
- If the target was intentionally removed, update the client's configured endpoint
Example fix
// before err := ssrf.ValidateHost(ctx, "retired-service.internal", cfg) // record removed // after err := ssrf.ValidateHost(ctx, "active-service.internal", cfg)
Defensive patterns
Strategy: validation
Validate before calling
addrs, err := net.LookupHost(host)
if err != nil || len(addrs) == 0 {
return fmt.Errorf("%s has no DNS records; fix configuration or DNS zone", host)
} Try / catch
if err := ssrf.ValidateURL(ctx, endpoint, cfg); err != nil {
if strings.Contains(err.Error(), "resolved to no addresses") {
return fmt.Errorf("DNS for %s returned no records; verify the host still exists", host(endpoint))
}
return err
} Prevention
- Monitor DNS records of configured dependencies (empty answers usually mean decommissioning)
- Configure endpoints by stable hostname with existing A/AAAA records, not names you plan to drain
- Cross-check `dig +short` output before promoting an endpoint
When it happens
Trigger: Calling ssrf.ValidateURL / ValidateHost with a hostname whose DNS record was just deleted or whose resolver returns an empty A/AAAA answer set (e.g. a round-robin entry drained to zero, or a resolver that swallows errors into empty replies).
Common situations: A service's DNS record removed during a decommission while clients still reference it; a load-balancer DNS name with all backends deregistered; misconfigured DNS zone with an empty answer; stale local resolver cache returning an empty response.
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
- ssrf: could not parse resolved IP
- ssrf: DNS resolution failed for
- awscreds: AWS_EC2_METADATA_SERVICE_ENDPOINT is not a valid…
- awscreds: refusing plaintext container credentials endpoint…
- awscreds: refusing plaintext IMDS endpoint at host
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/05e41e8b00d2e231.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/ssrf/ssrf.go:272
}
// "localhost" is explicitly blocked regardless of what DNS says — unless a
// self-hosted operator allowlisted it (resolution still runs, so every
// resolved address is range-checked below like any other).
if strings.EqualFold(host, "localhost") && !(!cfg.ManagedMode && isInAllowList(host, port, cfg.AllowList)) {
return fmt.Errorf("ssrf: host %q is blocked (loopback)", host)
}
// Resolve ALL addresses the hostname currently maps to. A hostname that
// returns even one blocked address is rejected (defense-in-depth against
// split-horizon / DNS rebinding scenarios where the pre-flight check and
// the dial see different answers).
addrs, err := net.DefaultResolver.LookupIPAddr(ctx, host)
if err != nil {
return fmt.Errorf("ssrf: DNS resolution failed for %q: %w", host, err)
}
if len(addrs) == 0 {
return fmt.Errorf("ssrf: host %q resolved to no addresses", host)
}
for _, ia := range addrs {
a, ok := netip.AddrFromSlice(ia.IP)
if !ok {
return fmt.Errorf("ssrf: could not parse resolved IP %v for host %q", ia.IP, host)
}
a = a.Unmap() // normalise ::ffff:x.x.x.x → x.x.x.x
if err := checkAddr(a, host, port, cfg); err != nil {
return err
}
}
return nil
}
// validateHostInput rejects URL/userinfo-shaped values before they reach DNS
// or an error formatter. IP literals (including zoned IPv6) are handled by
// netip.ParseAddr and may contain colons or a zone identifier.View on GitHub (pinned to 3ee70a1026)