owasp-amass/amass · error
error reading the response from the WHOIS server: %v
Error message
error reading the response from the WHOIS server: %v
What it means
The bgptools WHOIS plugin wraps read errors from io.ReadAll when receiving the WHOIS response over the TCP connection. The connection was established and the request written, but reading the reply failed — typically a timeout, connection reset, or premature close while the response was in flight.
Source
Thrown at engine/plugins/whois/bgptools/plugin.go:152
_ = bt.rlimit.Wait(ctx)
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
conn, err := dial(ctx, "tcp", addr)
if err != nil {
return nil, fmt.Errorf("failed to establish a connection with the WHOIS server: %v", err)
}
defer func() { _ = conn.Close() }()
n, err := io.WriteString(conn, fmt.Sprintf("begin\n%s\nend", ipstr))
if err != nil || n == 0 {
return nil, fmt.Errorf("failed to send the request to the WHOIS server: %v", err)
}
data, err := io.ReadAll(conn)
if err != nil {
return nil, fmt.Errorf("error reading the response from the WHOIS server: %v", err)
}
record := strings.Split(string(data), "|")
// Ensure the record contains the necessary details (AutonomousSystem and Netblock)
if len(record) < 7 {
return nil, errors.New("received insufficient data from the WHOIS server")
}
var r bgpToolsRecord
for i, f := range record {
field := strings.TrimSpace(f)
switch i {
case 0:
num, err := strconv.Atoi(field)
if err != nil {
return nil, err
}View on GitHub (pinned to 79299dce87)
Solutions
- Inspect the wrapped cause — timeout vs connection reset points to different fixes
- Increase or verify the 10s timeout if responses are consistently slow on this network
- Retry with backoff; transient resets/timeouts often succeed on a second attempt
- Check for rate limiting from bgp.tools and slow down query volume
- Ensure no middleboxes (VPN/proxy) are resetting long-lived TCP connections
Example fix
// before ctx, cancel := context.WithTimeout(ctx, 10*time.Second) // after ctx, cancel := context.WithTimeout(ctx, 30*time.Second) // allow for slow WHOIS responses
Defensive patterns
Strategy: retry
Validate before calling
// ensure generous deadline before reading ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel()
Try / catch
if err != nil {
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
// increase timeout and/or retry
}
// otherwise treat as transient reset and retry with backoff
} Prevention
- Allow a timeout larger than the worst-case WHOIS response time
- Retry transient read failures with exponential backoff
- Avoid running bulk queries over unstable links (mobile/VPN); prefer wired/stable networks
- Monitor for rate limiting and throttle query volume
When it happens
Trigger: Calling whois(ctx, ipstr) where io.ReadAll(conn) returns an error after the request was written: the 10s context/deadline expired before the server finished responding, the connection was reset mid-response, or the peer closed the socket in an error state.
Common situations: Slow or overloaded bgp.tools service exceeding the 10s deadline; rate limiting causing truncated/reset responses; flaky mobile/VPN networks dropping long-lived connections; firewalls killing connections that stay open waiting for data.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- failed to establish a connection with the WHOIS server: %v
- failed to send the request to the WHOIS server: %v
- probes were not successful against the target
- failed to obtain the BGPTools IP address
- received insufficient data from the WHOIS server
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/e6c7e332ed9c25bf.
Report an issue: GitHub.