denoland/deno · error · TypeError
The bench function must have a name
Error message
The bench function must have a name
What it means
On Linux, deep-link registration rewrites the `.desktop` entry inside the application bundle: it appends `x-scheme-handler/<scheme>;` MIME types and ensures `Exec=` forwards the opened URL via the `%u` field code. This error means the bundle directory contains no file with a `.desktop` extension to patch.
Source
Thrown at cli/js/40_bench.js:143
throw new TypeError(
"Unexpected 'fn' field in options, bench function is already provided as the third argument",
);
}
if (optionsOrFn.name != undefined) {
throw new TypeError(
"Unexpected 'name' field in options, bench name is already provided as the first argument",
);
}
benchDesc = {
...defaults,
...optionsOrFn,
fn: maybeFn,
name: nameOrFnOrOptions,
};
}
} else if (typeof nameOrFnOrOptions === "function") {
if (!nameOrFnOrOptions.name) {
throw new TypeError("The bench function must have a name");
}
if (optionsOrFn != undefined) {
throw new TypeError("Unexpected second argument to Deno.bench()");
}
if (maybeFn != undefined) {
throw new TypeError("Unexpected third argument to Deno.bench()");
}
benchDesc = {
...defaults,
fn: nameOrFnOrOptions,
name: nameOrFnOrOptions.name,
};
} else {
let fn;
let name;
if (typeof optionsOrFn === "function") {
fn = optionsOrFn;
if (nameOrFnOrOptions.fn != undefined) {View on GitHub (pinned to 89f33cbef2)
Solutions
- Rebuild the bundle from a clean state so the packaging step regenerates the `.desktop` file
- Inspect the printed bundle path and confirm a `*.desktop` file exists; restore or rename it if it was altered
- Verify the backend/target combination actually ships Linux desktop integration; try the default target
- If the cached backend download may be stale, clear the laufey cache dir and re-run so it re-downloads and re-extracts
Defensive patterns
Strategy: validation
Validate before calling
for (const e of Deno.readDirSync(bundleDir)) {
if (e.isFile && e.name.endsWith('.desktop')) return; // ok, registration can proceed
}
throw new Error(`no .desktop file in ${bundleDir} — rebuild the bundle`); Prevention
- Keep the packaging step that emits the .desktop entry in every Linux bundle pipeline
- Run deep-link registration only against freshly built bundle output
- Add a post-packaging assertion that the bundle contains a .desktop file
When it happens
Trigger: The Linux deep-link registration step running against a bundle directory whose packaging produced no `.desktop` entry, or one that was renamed, moved, or deleted after packaging.
Common situations: A custom/simplified packaging step that skips desktop integration; stale or partially deleted build output from an earlier run; a laufey backend archive whose on-disk layout differs from what this Deno expects.
Related errors
- Unexpected 'name' field in options, bench name is already pr
- ${prefix}Linter plugin name must be a string
- Unexpected second argument to Deno.bench()
- Unexpected third argument to Deno.bench()
- Unexpected 'fn' field in options, bench function is already
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/41fe776b3e179452.
Report an issue: GitHub.