nodejs/node · error
%s: %s
Error message
%s: %s
What it means
Printed by ahost's callback() at ahost.c:217 when the DNS lookup initiated by ares_gethostbyname or ares_gethostbyaddr completes with a non-success status. The callback receives (arg, status, timeouts, host) where arg is the original hostname/IP string. The message formats as 'hostname: ares-error-string'. The callback returns without printing addresses since none are available.
Source
Thrown at deps/cares/src/tools/ahost.c:217
ares_destroy(channel);
ares_library_cleanup();
#ifdef USE_WINSOCK
WSACleanup();
#endif
return 0;
}
static void callback(void *arg, int status, int timeouts, struct hostent *host)
{
char **p;
(void)timeouts;
if (status != ARES_SUCCESS) {
fprintf(stderr, "%s: %s\n", (char *)arg, ares_strerror(status));
return;
}
for (p = host->h_addr_list; *p; p++) {
char addr_buf[46] = "??";
ares_inet_ntop(host->h_addrtype, *p, addr_buf, sizeof(addr_buf));
printf("%-32s\t%s", host->h_name, addr_buf);
puts("");
}
}
static void ai_callback(void *arg, int status, int timeouts,
struct ares_addrinfo *result)
{
struct ares_addrinfo_node *node = NULL;
(void)timeouts;
View on GitHub (pinned to 1b2de5e052)
Solutions
- Check the ares_strerror() portion of the message: ENOTFOUND means the name does not exist, ETIMEOUT means the resolver is unreachable.
- Verify the domain name is spelled correctly and exists in DNS (cross-check with 'dig' or 'nslookup').
- For AAAA failures, confirm the domain actually has IPv6 records (try -t a instead of -t aaaa).
- If timeouts persist, verify network connectivity to the DNS server and try an alternate resolver (-s 8.8.8.8).
Example fix
// before: querying AAAA for IPv4-only domain ahost -t aaaa ipv4-only.example.com // -> 'ipv4-only.example.com: ...' // after: query the correct record type ahost -t a ipv4-only.example.com
Defensive patterns
Strategy: fallback
Validate before calling
// Pre-check domain existence is not practical for DNS.
// Instead, validate name syntax before querying:
validate_domain() {
local name="$1"
[ ${#name} -le 253 ] || return 1
return 0
}
validate_domain "$DOMAIN" || { echo "invalid name" >&2; exit 1; } Try / catch
// In the callback, handle non-success gracefully
static void callback(void *arg, int status, int timeouts, struct hostent *host) {
if (status != ARES_SUCCESS) {
fprintf(stderr, "%s: %s\n", (char *)arg, ares_strerror(status));
// fall back to alternate resolver or report gracefully
return;
}
// process host->h_addr_list
} Prevention
- Verify domain names exist before scripted lookups (e.g., with a preliminary check).
- For AAAA queries, confirm the domain has IPv6 records or fall back to A records.
- Configure alternate DNS servers to improve resilience against resolver failures.
- Handle ARES_ENOTFOUND and ARES_ETIMEOUT distinctly in callback logic.
When it happens
Trigger: The callback registered with ares_gethostbyname/ares_gethostbyaddr is invoked by c-ares with status != ARES_SUCCESS. Triggered when the DNS server returns NXDOMAIN (ARES_ENOTFOUND), a SERVFAIL (ARES_ESERVFAIL), a timeout (ARES_ETIMEOUT after all retries), or when the name cannot be resolved for the requested family (e.g., querying AAAA for a name with only A records returns ARES_ENODATA).
Common situations: Looking up a nonexistent domain (NXDOMAIN). The DNS server is unreachable (timeout). Querying AAAA records for an IPv4-only domain. The domain exists but has no records of the requested type. Network connectivity issues prevent reaching the configured DNS resolver.
Related errors
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/c3fa8c426720d015.
Report an issue: GitHub.