{"record":{"id":"41fe776b3e179452","repo":"denoland/deno","slug":"the-bench-function-must-have-a-name","errorCode":null,"errorMessage":"The bench function must have a name","messagePattern":"The bench function must have a name","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"cli/js/40_bench.js","lineNumber":143,"sourceCode":"        throw new TypeError(\n          \"Unexpected 'fn' field in options, bench function is already provided as the third argument\",\n        );\n      }\n      if (optionsOrFn.name != undefined) {\n        throw new TypeError(\n          \"Unexpected 'name' field in options, bench name is already provided as the first argument\",\n        );\n      }\n      benchDesc = {\n        ...defaults,\n        ...optionsOrFn,\n        fn: maybeFn,\n        name: nameOrFnOrOptions,\n      };\n    }\n  } else if (typeof nameOrFnOrOptions === \"function\") {\n    if (!nameOrFnOrOptions.name) {\n      throw new TypeError(\"The bench function must have a name\");\n    }\n    if (optionsOrFn != undefined) {\n      throw new TypeError(\"Unexpected second argument to Deno.bench()\");\n    }\n    if (maybeFn != undefined) {\n      throw new TypeError(\"Unexpected third argument to Deno.bench()\");\n    }\n    benchDesc = {\n      ...defaults,\n      fn: nameOrFnOrOptions,\n      name: nameOrFnOrOptions.name,\n    };\n  } else {\n    let fn;\n    let name;\n    if (typeof optionsOrFn === \"function\") {\n      fn = optionsOrFn;\n      if (nameOrFnOrOptions.fn != undefined) {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_bench.js#L125-L161","documentation":"During `deno uninstall <name>`, deno builds `<bin_dir>/<name>` (plus `<name>.cmd`/`<name>.exe` on Windows) and calls `remove_file_if_exists` for each. If none of those files existed, nothing was removed and deno aborts with this error rather than reporting success on a no-op. It also then cleans up legacy `<name>.tsconfig.json` / `<name>.deno.json` / `<name>.lock.json` siblings, but only after a successful removal.","triggerScenarios":"`deno uninstall cowsay` when no `cowsay` executable exists in the resolved bin dir: the name is misspelled, the package was installed under a different (possibly inferred) bin name, or the install root used now differs from the one used at install time (`DENO_INSTALL_ROOT` changed, `--root` not passed).","commonSituations":"Typo in the package/binary name; the installed shim name came from the package's `bin` map (e.g. package `@foo/cli` installs shim `foobar`) and the user uninstalls the package name instead; `DENO_INSTALL_ROOT` differs between the installing shell and the current shell; the tool was already uninstalled.","solutions":["List what is actually installed: `ls ~/.deno/bin` (or `ls \"$DENO_INSTALL_ROOT/bin\"`)","Re-run uninstall with the exact shim filename found there (omit extension on Windows)","If a custom root was used at install time, pass the same `--root <dir>`","If nothing relevant exists, the uninstall goal is already met — ignore or script around it"],"exampleFix":"# before\n$ deno uninstall @foo/cli\n# No installation found for @foo/cli\n\n# after\n$ ls ~/.deno/bin\nfoobar*\n$ deno uninstall foobar  # removed","handlingStrategy":"validation","validationCode":"# Check the shim exists before attempting uninstall\nBIN_DIR=\"${DENO_INSTALL_ROOT:-$HOME/.deno}/bin\"\ncommand -v \"$BIN_DIR/$PKG\" >/dev/null 2>&1 || ls \"$BIN_DIR\" | grep -i \"$PKG\"","typeGuard":null,"tryCatchPattern":"In automation scripts, call `deno uninstall <name>` and on failure match /No installation found/ — treat it as already-clean (exit 0) instead of failing the pipeline; any other stderr should fail loudly.","preventionTips":["Install with an explicit `--name` so the shim name never depends on inference rules","Keep DENO_INSTALL_ROOT identical in install and uninstall shells","After installing, note the printed shim path; use that exact name to uninstall"],"tags":["uninstall","package-management","bin-name"],"backgroundTag":"package-not-installed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}