nodejs/node · error

ares_set_servers_ports_csv: %s: %s

Error message

ares_set_servers_ports_csv: %s: %s

What it means

Printed by adig's main() at adig.c:1540 when ares_set_servers_ports_csv() fails to parse or apply the user-specified DNS server list (global_config.servers). The message includes both the c-ares error string and the raw servers CSV string that was rejected. This only executes if global_config.servers is non-NULL (i.e., the user provided -s or configured servers in the rcfile).

Source

Thrown at deps/cares/src/tools/adig.c:1540

    rv = 1;
    goto done;
  }

  config_opts();

  status = (ares_status_t)ares_init_options(&channel, &global_config.options,
                                            global_config.optmask);
  if (status != ARES_SUCCESS) {
    fprintf(stderr, "ares_init_options: %s\n", ares_strerror((int)status));
    rv = 1;
    goto done;
  }

  if (global_config.servers) {
    status =
      (ares_status_t)ares_set_servers_ports_csv(channel, global_config.servers);
    if (status != ARES_SUCCESS) {
      fprintf(stderr, "ares_set_servers_ports_csv: %s: %s\n",
              ares_strerror((int)status), global_config.servers);
      rv = 1;
      goto done;
    }
  }

  /* Debug */
  if (global_config.opts.display_command) {
    printf("\n; <<>> c-ares DiG %s <<>>", ares_version(NULL));
    printf(" %s", global_config.name);
    printf("\n");
  }

  /* Enqueue a query for each separate name */
  status = enqueue_query(channel);
  if (status != ARES_SUCCESS) {
    fprintf(stderr, "Failed to create query for %s: %s\n", global_config.name,
            ares_strerror((int)status));

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Inspect the second %s in the message — it is the exact servers string that was rejected; correct any typos or formatting issues.
  2. Use the documented CSV format: comma-separated 'IP[:port]' entries (e.g., '8.8.8.8:53,1.1.1.1:53').
  3. For IPv6 servers, ensure proper formatting (e.g., '[2001:4860:4860::8888]:53').
  4. Test with a single known-good server first ('8.8.8.8') to isolate whether one entry in a multi-server list is the problem.

Example fix

// before: malformed server CSV
adig -s '8.8.8.8:99999' example.com
// -> 'ares_set_servers_ports_csv: ...: 8.8.8.8:99999'

// after: valid port
adig -s '8.8.8.8:53' example.com
Defensive patterns

Strategy: validation

Validate before calling

// Validate server CSV format before passing to adig or c-ares
validate_server_csv() {
    local csv="$1"
    IFS=',' read -ra addrs <<< "$csv"
    for addr in "${addrs[@]}"; do
        local ip="${addr%%:*}"
        if ! [[ "$ip" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
            echo "invalid server IP: $ip" >&2; return 1
        fi
    done
}
validate_server_csv "$SERVERS" && adig -s "$SERVERS" example.com

Try / catch

status = (ares_status_t)ares_set_servers_ports_csv(channel, servers);
if (status != ARES_SUCCESS) {
    fprintf(stderr, "bad servers: %s\n", servers);
    // fall back to system default servers
    status = ARES_SUCCESS;  // channel already has defaults
}

Prevention

When it happens

Trigger: Calling ares_set_servers_ports_csv() at line 1538 with a CSV string like '8.8.8.8,1.1.1.1' or '8.8.8.8:53;1.1.1.1:53'. Fails when the string contains unparseable addresses, invalid port numbers, mixed/unsupported address families, or is empty. The function returns ARES_EBADSTR or similar.

Common situations: A user passes a malformed server string like '8.8.8.8:99999' (port out of range), 'not-an-ip' (unparseable), or uses the wrong delimiter for the expected CSV format. A configuration file has a typo in the servers line. The server string uses IPv6 without brackets on systems that require them.

Related errors


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