{"record":{"id":"45c812735f2b5796","repo":"denoland/deno","slug":"no-callback-function-supplied-45c812","errorCode":null,"errorMessage":"No callback function supplied","messagePattern":"No callback function supplied","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/_fs/_fs_lstat.ts","lineNumber":35,"sourceCode":"const {\n  Error,\n  PromisePrototypeThen,\n  ObjectPrototypeIsPrototypeOf,\n} = primordials;\n\nfunction lstat(\n  path,\n  optionsOrCallback,\n  maybeCallback,\n) {\n  const callback = typeof optionsOrCallback === \"function\"\n    ? optionsOrCallback\n    : maybeCallback;\n  const options = typeof optionsOrCallback === \"object\"\n    ? optionsOrCallback\n    : { bigint: false };\n\n  if (!callback) throw new Error(\"No callback function supplied\");\n\n  // Match Node: errors carry the requested path (see lib/fs.js lstat).\n  const validatedPath = lazyFsUtils().getValidatedPathToString(path);\n  PromisePrototypeThen(\n    Deno.lstat(validatedPath),\n    (stat) => callback(null, lazyStatUtils().CFISBIS(stat, options.bigint)),\n    (err) => {\n      // Match Node: `{ throwIfNoEntry: false }` suppresses ENOENT and yields\n      // undefined stats (see lib/fs.js lstat()).\n      if (\n        options?.throwIfNoEntry === false &&\n        ObjectPrototypeIsPrototypeOf(Deno.errors.NotFound.prototype, err)\n      ) {\n        callback(null, undefined);\n        return;\n      }\n      callback(\n        denoErrorToNodeError(err, {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/ext/node/polyfills/_fs/_fs_lstat.ts#L17-L53","documentation":"fs.lstat(path, [options], callback) throws this plain Error (no error code) when no callback can be resolved: the callback is taken from optionsOrCallback if that is a function, otherwise from maybeCallback. It is a pure API-misuse error meaning you used the callback-based fs.lstat without supplying one.","triggerScenarios":"fs.lstat('/tmp') with one argument, or fs.lstat('/tmp', { bigint: true }) where the second argument is an options object and no third function argument follows.","commonSituations":"Developer intends the promise API but imports the callback-style fs.lstat; refactoring from fs.promises.lstat to fs.lstat and forgetting the callback; passing a null callback.","solutions":["Use fs.promises.lstat(path, options) if you want a Promise","Otherwise append a callback: fs.lstat(path, (err, stats) => { ... })","Make sure the callback is passed as the argument right after options, not nested inside the options object"],"exampleFix":"// before\nfs.lstat(path, { bigint: true });\n\n// after\nfs.promises.lstat(path, { bigint: true });\n// or\nfs.lstat(path, { bigint: true }, (err, stats) => { if (err) throw err; });","handlingStrategy":"validation","validationCode":"if (typeof maybeCallback !== 'function' && typeof optionsOrCallback !== 'function') {\n  throw new Error('lstat requires a callback; use fs.promises.lstat for promises');\n}","typeGuard":"const isCallback = (v) => typeof v === 'function';","tryCatchPattern":null,"preventionTips":["Prefer fs.promises.lstat in modern async code","Enable @types/node so TS flags the missing callback argument","In wrappers, assert the last forwarded arg is a function"],"tags":["node-compat","fs","lstat","callback","api-misuse"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}