denoland/deno · error · TypeError

Unexpected third argument to Deno.bench()

Error message

Unexpected third argument to Deno.bench()

What it means

The configured desktop icon path, resolved by joining the config value with the initial working directory, does not exist on disk, so HMR startup cannot pass an icon to laufey.

Source

Thrown at cli/js/40_bench.js:149

          "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) {
        throw new TypeError(
          "Unexpected 'fn' field in options, bench function is already provided as the second argument",
        );
      }
      name = nameOrFnOrOptions.name ?? fn.name;
    } else {

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Verify the printed path exists and fix typos or letter casing
  2. Run the command from the project root, or use an absolute path for the icon
  3. Generate/copy the icon file first if it comes from a build or asset step

Example fix

# before
# on-disk file is icons/App.png
"icon": "icons/app.png"

# after
"icon": "icons/App.png"
Defensive patterns

Strategy: validation

Validate before calling

const iconPath = resolve(projectRoot, iconFromConfig);
await Deno.stat(iconPath); // throws if missing — run before `deno desktop`

Prevention

When it happens

Trigger: `deno desktop` (HMR/dev mode on macOS) with an `icon` pointing at a missing file: typo, wrong case, path relative to a different cwd, or an asset that has not been generated yet.

Common situations: Running the CLI from a directory other than the project root the config assumes; icons produced by an asset-generation step that has not run; case-sensitivity mismatches when a config authored on macOS is used on Linux.

Related errors


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