{"record":{"id":"3c814ecf71dd70ae","repo":"owasp-amass/amass","slug":"received-insufficient-data-from-the-whois-server","errorCode":null,"errorMessage":"received insufficient data from the WHOIS server","messagePattern":"received insufficient data from the WHOIS server","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/plugins/whois/bgptools/plugin.go","lineNumber":158,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to establish a connection with the WHOIS server: %v\", err)\n\t}\n\tdefer func() { _ = conn.Close() }()\n\n\tn, err := io.WriteString(conn, fmt.Sprintf(\"begin\\n%s\\nend\", ipstr))\n\tif err != nil || n == 0 {\n\t\treturn nil, fmt.Errorf(\"failed to send the request to the WHOIS server: %v\", err)\n\t}\n\n\tdata, err := io.ReadAll(conn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading the response from the WHOIS server: %v\", err)\n\t}\n\n\trecord := strings.Split(string(data), \"|\")\n\t// Ensure the record contains the necessary details (AutonomousSystem and Netblock)\n\tif len(record) < 7 {\n\t\treturn nil, errors.New(\"received insufficient data from the WHOIS server\")\n\t}\n\n\tvar r bgpToolsRecord\n\tfor i, f := range record {\n\t\tfield := strings.TrimSpace(f)\n\n\t\tswitch i {\n\t\tcase 0:\n\t\t\tnum, err := strconv.Atoi(field)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tr.ASN = num\n\t\tcase 1:\n\t\t\tip, err := netip.ParseAddr(field)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/whois/bgptools/plugin.go#L140-L176","documentation":"The bgptools WHOIS query (whois method) parses the server's pipe-delimited response by splitting on '|'. If fewer than 7 fields come back, the record cannot contain both the AutonomousSystem and Netblock data the parser requires, so it returns errors.New(\"received insufficient data from the WHOIS server\"). The response format deviates from what the plugin expects.","triggerScenarios":"Calling the plugin's whois lookup for an IP/ASN and the WHOIS server replies with a pipe-separated line with len(strings.Split(data, \"|\")) < 7 — error pages, empty responses, or format changes all trigger it.","commonSituations":"Querying an IP or ASN with no bgp.tools record; WHOIS server rate-limiting or returning an error banner; bgp.tools changing its response format; connection returning truncated/partial data.","solutions":["Verify the queried IP/ASN is one bgp.tools has data for (test with whois -h bgp.tools <ip>).","Retry later — rate-limit or transient server issues may cause short/invalid responses.","Check the raw WHOIS response manually to see whether bgp.tools changed its field layout, and update the parser expectations if so.","Handle the error per-record: skip the asset and continue enumeration instead of aborting."],"exampleFix":"// before\nrecord := strings.Split(string(data), \"|\")\nif len(record) < 7 {\n    return nil, errors.New(\"received insufficient data from the WHOIS server\")\n}\n// after\nrecord := strings.Split(string(data), \"|\")\nif len(record) < 7 {\n    log.Warn(\"bgptools WHOIS response too short, skipping\", \"fields\", len(record), \"raw\", string(data))\n    return nil, nil // skip this record instead of failing\n}","handlingStrategy":"validation","validationCode":"// Pre-check the raw WHOIS shape before parsing\ndata, err := queryWhois(addr)\nif err != nil { return err }\nif strings.Count(string(data), \"|\") < 6 {\n    return fmt.Errorf(\"malformed bgptools response: %q\", string(data))\n}","typeGuard":null,"tryCatchPattern":"rec, err := whois(ip)\nif err != nil && strings.Contains(err.Error(), \"received insufficient data\") {\n    log.Warn(\"skipping asset: short bgptools record\", \"ip\", ip)\n    return nil\n}","preventionTips":["Validate queried IPs/ASNs are in scope for bgp.tools data.","Respect WHOIS rate limits to avoid error/short responses.","Pin/parser tests against the current bgptools field layout.","Skip and log offending records rather than aborting the whole scan."],"tags":["whois","response-format","parsing"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}