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

  1. Rebuild the bundle from a clean state so the packaging step regenerates the `.desktop` file
  2. Inspect the printed bundle path and confirm a `*.desktop` file exists; restore or rename it if it was altered
  3. Verify the backend/target combination actually ships Linux desktop integration; try the default target
  4. 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

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


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/41fe776b3e179452. Report an issue: GitHub.