denoland/deno · error · Error
No callback function supplied
Error message
No callback function supplied
What it means
fs.lutimes(path, atime, mtime, callback) throws this plain Error (no code) when callback is falsy. Unlike lstat/readdir it has no options overload, so exactly four arguments are expected; calling it with three (or with a missing/undefined callback) always trips this guard before any time validation happens.
Source
Thrown at ext/node/polyfills/_fs/_fs_lutimes.ts:60
const unixSeconds = toUnixTimestamp(value);
const seconds = MathTrunc(unixSeconds);
const nanoseconds = MathTrunc((unixSeconds * 1e3) - (seconds * 1e3)) * 1e6;
return [
seconds,
nanoseconds,
];
}
export function lutimes(
path: PathLike,
atime: TimeLike,
mtime: TimeLike,
callback: CallbackWithError,
): void {
if (!callback) {
throw new Error("No callback function supplied");
}
const { 0: atimeSecs, 1: atimeNanos } = getValidUnixTime(atime, "atime");
const { 0: mtimeSecs, 1: mtimeNanos } = getValidUnixTime(mtime, "mtime");
path = getValidatedPathToString(path);
PromisePrototypeThen(
op_node_lutimes(path, atimeSecs, atimeNanos, mtimeSecs, mtimeNanos),
() => callback(null),
callback,
);
}
export function lutimesSync(
path: PathLike,
atime: TimeLike,
mtime: TimeLike,
): void {View on GitHub (pinned to 89f33cbef2)
Solutions
- Use fs.promises.lutimes(path, atime, mtime) for promise-style code
- Otherwise pass a fourth function argument: fs.lutimes(path, atime, mtime, err => { ... })
- In wrappers, assert typeof args[3] === 'function' before delegating
Example fix
// before
fs.lutimes(path, atime, mtime);
// after
await fs.promises.lutimes(path, atime, mtime);
// or
fs.lutimes(path, atime, mtime, (err) => { if (err) throw err; }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof callback !== 'function') {
throw new Error('lutimes(path, atime, mtime, callback) requires a 4th callback argument');
} Type guard
const isCallback = (v) => typeof v === 'function';
Prevention
- Use fs.promises.lutimes for promise-style code
- lutimes has no options overload — the 4th positional argument is always the callback
- Let TypeScript's arity checking catch missing arguments
When it happens
Trigger: fs.lutimes(path, atime, mtime) with no fourth argument; destructuring a callback from an object that does not define it and passing undefined.
Common situations: Switching from fs.promises.lutimes to fs.lutimes and dropping the callback; writing a wrapper that forwards (...args) but callers omit the last one.
Related errors
- No callback function supplied
- No callback function supplied
- No callback function supplied
- invalid ${name}, must not be infinity or NaN
- A file exists at the destination: ${destStr}
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/c5277b1d548fbc29.
Report an issue: GitHub.