nodejs/node · error

ares_set_serveres_csv: %s

Error message

ares_set_serveres_csv: %s

What it means

Printed by ahost's main() at ahost.c:155 when ares_set_servers_csv() fails to apply the user-provided server list. Note the message itself contains a typo ('ares_set_serveres_csv' with an extra 'e') — this is a bug in the source string at line 155, not a different function. The ares_strerror(status) detail identifies the parsing or application failure. The tool frees servers, calls usage(), and returns 1.

Source

Thrown at deps/cares/src/tools/ahost.c:155

  }

  argc -= state.optind;
  argv += state.optind;
  if (argc < 1) {
    usage();
  }

  status = ares_init_options(&channel, &options, optmask);
  if (status != ARES_SUCCESS) {
    free(servers);
    fprintf(stderr, "ares_init: %s\n", ares_strerror(status));
    return 1;
  }

  if (servers) {
    status = ares_set_servers_csv(channel, servers);
    if (status != ARES_SUCCESS) {
      fprintf(stderr, "ares_set_serveres_csv: %s\n", ares_strerror(status));
      free(servers);
      usage();
      return 1;
    }
    free(servers);
  }

  /* Initiate the queries, one per command-line argument. */
  for (; *argv; argv++) {
    if (ares_inet_pton(AF_INET, *argv, &addr4) == 1) {
      ares_gethostbyaddr(channel, &addr4, sizeof(addr4), AF_INET, callback,
                         *argv);
    } else if (ares_inet_pton(AF_INET6, *argv, &addr6) == 1) {
      ares_gethostbyaddr(channel, &addr6, sizeof(addr6), AF_INET6, callback,
                         *argv);
    } else {
      struct ares_addrinfo_hints hints;
      memset(&hints, 0, sizeof(hints));

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Pass only bare IP addresses to ahost -s: 'ahost -s 8.8.8.8 example.com' (no port suffix).
  2. For multiple servers, use the CSV format accepted by ares_set_servers_csv: 'ahost -s 8.8.8.8,1.1.1.1 example.com'.
  3. Check the ares_strerror() output for the specific parse failure.
  4. Note the message typo ('serveres') is cosmetic and does not indicate a different function — the actual call is to ares_set_servers_csv.

Example fix

// before: port suffix not supported by ares_set_servers_csv
ahost -s '8.8.8.8:53' example.com
// -> 'ares_set_serveres_csv: ...' (note typo in message)

// after: bare IP without port
ahost -s '8.8.8.8' example.com
Defensive patterns

Strategy: validation

Validate before calling

// Validate server IPs before passing to ahost -s
validate_ip() {
    local ip="$1"
    # ares_set_servers_csv expects bare IPs, no port
    if ! [[ "$ip" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
        echo "invalid server IP: $ip" >&2; return 1
    fi
}
validate_ip "$SERVER_IP" && ahost -s "$SERVER_IP" "$DOMAIN"

Try / catch

status = ares_set_servers_csv(channel, servers);
if (status != ARES_SUCCESS) {
    fprintf(stderr, "servers CSV rejected: %s\n", servers);
    // fall back to system-configured DNS servers
    // (don't call ares_set_servers_csv at all)
}

Prevention

When it happens

Trigger: Calling ares_set_servers_csv(channel, servers) at line 152, where servers was set via -s. Fails when the CSV string contains unparseable IP addresses, unsupported formats, or empty entries. Unlike adig's version (which uses ares_set_servers_ports_csv with port support), ahost uses ares_set_servers_csv which does not parse port suffixes.

Common situations: A user passes a port-qualified server string like '8.8.8.8:53' to ahost, but ares_set_servers_csv may not parse port suffixes (unlike adig's _ports_ variant). Passing multiple comma-separated servers in a format the function does not accept. Passing a non-IP string. This message also has a cosmetic typo ('serveres') that has been present in the source.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/fe986c7fe7351f25. Report an issue: GitHub.