{"record":{"id":"53299088e2f6e095","repo":"nodejs/node","slug":"failed-to-create-query-for-s-s","errorCode":null,"errorMessage":"Failed to create query for %s: %s\n","messagePattern":"Failed to create query for (.+?): (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/cares/src/tools/adig.c","lineNumber":1557,"sourceCode":"    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));\n    rv = 1;\n    goto done;\n  }\n\n  /* Process events */\n  rv = event_loop(channel);\n\ndone:\n  free_config();\n  ares_destroy(channel);\n  ares_library_cleanup();\n\n#ifdef USE_WINSOCK\n  WSACleanup();\n#endif\n  return rv;\n}","sourceCodeStart":1539,"sourceCodeEnd":1575,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/cares/src/tools/adig.c#L1539-L1575","documentation":"Printed by adig's main() at adig.c:1557 when enqueue_query() returns a status other than ARES_SUCCESS. enqueue_query creates the DNS query for global_config.name using the configured query type and class. The message includes the query name and the ares_strerror() detail. The tool sets rv=1 and jumps to cleanup.","triggerScenarios":"Calling enqueue_query(channel) at line 1555 after the channel is successfully initialized. Fails when c-ares cannot construct the DNS query packet — e.g., the domain name exceeds 253 characters, contains invalid label characters, has labels exceeding 63 bytes, or the query type is unsupported by the c-ares version in use.","commonSituations":"A user queries an excessively long or malformed domain name. The query name contains characters that are not valid in DNS labels (underscores in hostnames, spaces, non-ASCII without IDN processing). The query type was set to a value c-ares does not support.","solutions":["Check the ares_strerror() output for the specific failure (e.g., ARES_EBADNAME for invalid domain name).","Validate the domain name length (max 253 chars) and label length (max 63 chars per label) before querying.","If using internationalized domain names, ensure IDN processing is enabled or convert to punycode first.","Verify the query type is supported by the c-ares version (use standard types: A, AAAA, CNAME, MX, TXT, NS, SOA, SRV)."],"exampleFix":"// before: invalid domain name\nadig 'exceedingly-long-label-'$(printf 'a%.0s' {1..70})'.example.com'\n// -> 'Failed to create query for ...: ...'\n\n// after: validate name length before querying\nname='my.example.com'\n[ ${#name} -le 253 ] && adig \"$name\" || echo 'name too long'","handlingStrategy":"validation","validationCode":"// Validate domain name before querying\nvalidate_domain() {\n    local name=\"$1\"\n    [ ${#name} -le 253 ] || { echo \"name too long\" >&2; return 1; }\n    # check each label is <= 63 chars and contains valid chars\n    IFS='.' read -ra labels <<< \"$name\"\n    for label in \"${labels[@]}\"; do\n        [ ${#label} -le 63 ] || { echo \"label too long\" >&2; return 1; }\n    done\n}\nvalidate_domain \"$DOMAIN\" && adig \"$DOMAIN\"","typeGuard":null,"tryCatchPattern":"status = enqueue_query(channel);\nif (status != ARES_SUCCESS) {\n    fprintf(stderr, \"query creation failed: %s\\n\", ares_strerror((int)status));\n    // skip this name, continue with others if batch processing\n}","preventionTips":["Validate domain name length (max 253 chars total, 63 per label) before querying.","Convert internationalized names to punycode before passing to adig.","Use only standard DNS query types supported by the installed c-ares version."],"tags":["c-ares","adig","dns-query","domain-name","validation"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}