{"record":{"id":"cdf7be4bb8905cbb","repo":"nodejs/node","slug":"missing-servers","errorCode":null,"errorMessage":"missing servers","messagePattern":"missing servers","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/cares/src/tools/ahost.c","lineNumber":120,"sourceCode":"        options.ndomains++;\n        options.domains = (char **)realloc(\n          options.domains, (size_t)options.ndomains * sizeof(char *));\n        options.domains[options.ndomains - 1] = strdup(state.optarg);\n        break;\n      case 't':\n        if (ares_strcaseeq(state.optarg, \"a\")) {\n          addr_family = AF_INET;\n        } else if (ares_strcaseeq(state.optarg, \"aaaa\")) {\n          addr_family = AF_INET6;\n        } else if (ares_strcaseeq(state.optarg, \"u\")) {\n          addr_family = AF_UNSPEC;\n        } else {\n          usage();\n        }\n        break;\n      case 's':\n        if (state.optarg == NULL) {\n          fprintf(stderr, \"%s\", \"missing servers\");\n          usage();\n          break;\n        }\n        if (servers) {\n          free(servers);\n        }\n        servers = strdup(state.optarg);\n        break;\n      case 'h':\n      case '?':\n        print_help_info_ahost();\n        break;\n      default:\n        usage();\n        break;\n    }\n  }\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/cares/src/tools/ahost.c#L102-L138","documentation":"Printed by ahost's main() at ahost.c:120 when the -s flag is passed but state.optarg is NULL — meaning no argument was supplied for the -s option. The message 'missing servers' is printed to stderr, followed by a call to usage(). The optarg being NULL typically indicates a malformed command line where -s is the last token with no following value.","triggerScenarios":"Invoking ahost with '-s' as the last argument or followed by another flag (e.g., 'ahost -s -t a example.com' where -t is consumed as the -s argument by some getopt implementations, or 'ahost -s' with nothing after). The ares_getopt parser sets state.optarg to NULL when no value follows the option.","commonSituations":"A user forgets to provide the server list after -s. A shell script constructs the command dynamically and the server variable is empty, producing a command where no argument is bound to -s. Option ordering causes another flag to be interpreted as the -s argument.","solutions":["Provide a valid server IP after -s: 'ahost -s 8.8.8.8 example.com'.","If building the command in a script, check that the server variable is non-empty before including -s.","Quote the argument properly: 'ahost -s \"$SERVER_IP\" example.com'.","Review the full command line for option ordering issues — put -s and its value before positional arguments."],"exampleFix":"// before: missing -s argument\nahost -s example.com\n// -> 'missing servers' + usage\n\n// after: provide server IP\nahost -s 8.8.8.8 example.com","handlingStrategy":"validation","validationCode":"// Validate -s argument presence before invoking ahost\nif [ -z \"$SERVER_IP\" ]; then\n    echo \"error: server IP is required for -s\" >&2\n    exit 1\nfi\nahost -s \"$SERVER_IP\" \"$DOMAIN\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always provide a value immediately after -s in the command line.","In scripts, check that the server variable is non-empty before including -s.","Place -s and its argument before positional (hostname) arguments."],"tags":["c-ares","ahost","command-line","usage-error","missing-argument"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}