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
- Verify the printed path exists and fix typos or letter casing
- Run the command from the project root, or use an absolute path for the icon
- 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
- Resolve icon paths against the project root, not the ambient cwd
- Commit icon assets to the repo or generate them in a pre-launch step
- Case-check filenames when sharing configs across macOS and Linux
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
- Unexpected second argument to Deno.bench()
- Unexpected 'name' field in options, bench name is already pr
- Unexpected 'fn' field in options, bench function is already
- BenchContext::end() has already been invoked
- ${prefix}Linter plugin must be an object
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/23a4c5ffefe38c79.
Report an issue: GitHub.