{"record":{"id":"8a00ac6a25a6852f","repo":"denoland/deno","slug":"err-missing-args-8a00ac","errorCode":"ERR_MISSING_ARGS","errorMessage":"The \"address\", \"port\", and \"callback\" arguments must be specified","messagePattern":"The \"address\", \"port\", and \"callback\" arguments must be specified","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/dns.ts","lineNumber":354,"sourceCode":") {\n  if (err) {\n    return this.callback!(handleDnsError(err, \"getnameinfo\", this.address));\n  }\n\n  this.callback!(err, hostname, service);\n}\n\nfunction lookupService(\n  address: string,\n  port: number,\n  callback: (\n    err: ErrnoException | null,\n    hostname?: string,\n    service?: string,\n  ) => void,\n): GetNameInfoReqWrap {\n  if (arguments.length !== 3) {\n    throw new ERR_MISSING_ARGS(\"address\", \"port\", \"callback\");\n  }\n\n  if (isIP(address) === 0) {\n    throw new ERR_INVALID_ARG_VALUE(\"address\", address);\n  }\n\n  port = validatePort(port);\n\n  validateFunction(callback, \"callback\");\n\n  const req = new GetNameInfoReqWrap();\n  req.callback = callback;\n  req.address = address;\n  req.port = port;\n  req.oncomplete = onlookupservice;\n\n  const errCode = cares.getnameinfo(req, address, port);\n  if (errCode) {","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/ext/node/polyfills/dns.ts#L336-L372","documentation":"dns.lookupService(address, port, callback) performs a strict arity check: it must be called with exactly 3 arguments. Fewer arguments (missing callback, port, or address) — and also extra arguments — throw ERR_MISSING_ARGS before any validation of the values themselves.","triggerScenarios":"dns.lookupService('127.0.0.1') or dns.lookupService('127.0.0.1', 80) without a callback; spreading an args array of the wrong length; calling with a 4th stray argument.","commonSituations":"Copy-pasting lookup()-style two-arg calls onto lookupService; optional-callback wrappers that pass undefined and still hit the !== 3 length check via extra arguments; adapting promise wrappers that forget the callback.","solutions":["Always supply all three: dns.lookupService(address, port, (err, hostname, service) => {})","In wrappers, check arguments.length === 3 (or fn.length usage) before delegating","Use the promise form (dnsPromises.lookupService) if you do not need a callback, keeping the two-value signature"],"exampleFix":"// before\ndns.lookupService('127.0.0.1', 80); // missing callback -> ERR_MISSING_ARGS\n\n// after\ndns.lookupService('127.0.0.1', 80, (err, hostname, service) => {\n  if (err) throw err;\n  console.log(hostname, service);\n});","handlingStrategy":"validation","validationCode":"function lookupServiceSafe(address, port, callback) {\n  if (arguments.length !== 3) throw new Error('lookupService requires (address, port, callback)');\n  return dns.lookupService(address, port, callback);\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (e?.code === 'ERR_MISSING_ARGS') return reply(400, 'address, port and callback are required'); throw e; }","preventionTips":["Remember lookupService has no promise-less form and no optional args","Prefer dnsPromises.lookupService(address, port) in async code","Check arguments.length in generic wrappers before delegating"],"tags":["node-compat","dns","validation","arity"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}