{"record":{"id":"a9464176df53d479","repo":"nodejs/node","slug":"ares-set-servers-ports-csv-s-s","errorCode":null,"errorMessage":"ares_set_servers_ports_csv: %s: %s\n","messagePattern":"ares_set_servers_ports_csv: (.+?): (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/cares/src/tools/adig.c","lineNumber":1540,"sourceCode":"    rv = 1;\n    goto done;\n  }\n\n  config_opts();\n\n  status = (ares_status_t)ares_init_options(&channel, &global_config.options,\n                                            global_config.optmask);\n  if (status != ARES_SUCCESS) {\n    fprintf(stderr, \"ares_init_options: %s\\n\", ares_strerror((int)status));\n    rv = 1;\n    goto done;\n  }\n\n  if (global_config.servers) {\n    status =\n      (ares_status_t)ares_set_servers_ports_csv(channel, global_config.servers);\n    if (status != ARES_SUCCESS) {\n      fprintf(stderr, \"ares_set_servers_ports_csv: %s: %s\\n\",\n              ares_strerror((int)status), global_config.servers);\n      rv = 1;\n      goto done;\n    }\n  }\n\n  /* Debug */\n  if (global_config.opts.display_command) {\n    printf(\"\\n; <<>> c-ares DiG %s <<>>\", ares_version(NULL));\n    printf(\" %s\", global_config.name);\n    printf(\"\\n\");\n  }\n\n  /* Enqueue a query for each separate name */\n  status = enqueue_query(channel);\n  if (status != ARES_SUCCESS) {\n    fprintf(stderr, \"Failed to create query for %s: %s\\n\", global_config.name,\n            ares_strerror((int)status));","sourceCodeStart":1522,"sourceCodeEnd":1558,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/cares/src/tools/adig.c#L1522-L1558","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the second %s in the message — it is the exact servers string that was rejected; correct any typos or formatting issues.","Use the documented CSV format: comma-separated 'IP[:port]' entries (e.g., '8.8.8.8:53,1.1.1.1:53').","For IPv6 servers, ensure proper formatting (e.g., '[2001:4860:4860::8888]:53').","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."],"exampleFix":"// before: malformed server CSV\nadig -s '8.8.8.8:99999' example.com\n// -> 'ares_set_servers_ports_csv: ...: 8.8.8.8:99999'\n\n// after: valid port\nadig -s '8.8.8.8:53' example.com","handlingStrategy":"validation","validationCode":"// Validate server CSV format before passing to adig or c-ares\nvalidate_server_csv() {\n    local csv=\"$1\"\n    IFS=',' read -ra addrs <<< \"$csv\"\n    for addr in \"${addrs[@]}\"; do\n        local ip=\"${addr%%:*}\"\n        if ! [[ \"$ip\" =~ ^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then\n            echo \"invalid server IP: $ip\" >&2; return 1\n        fi\n    done\n}\nvalidate_server_csv \"$SERVERS\" && adig -s \"$SERVERS\" example.com","typeGuard":null,"tryCatchPattern":"status = (ares_status_t)ares_set_servers_ports_csv(channel, servers);\nif (status != ARES_SUCCESS) {\n    fprintf(stderr, \"bad servers: %s\\n\", servers);\n    // fall back to system default servers\n    status = ARES_SUCCESS;  // channel already has defaults\n}","preventionTips":["Validate each IP address in the CSV string before passing it to -s.","Use the documented format: comma-separated IP[:port] entries.","For IPv6, use bracket notation: [2001:4860:4860::8888]:53."],"tags":["c-ares","adig","dns-servers","configuration","csv-parse"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}