{"record":{"id":"e47d0158ca80e4ed","repo":"denoland/deno","slug":"unexpected-name-field-in-options-bench-name-is","errorCode":null,"errorMessage":"Unexpected 'name' field in options, bench name is already provided as the first argument","messagePattern":"Unexpected 'name' field in options, bench name is already provided as the first argument","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"cli/js/40_bench.js","lineNumber":130,"sourceCode":"  };\n\n  if (typeof nameOrFnOrOptions === \"string\") {\n    if (!nameOrFnOrOptions) {\n      throw new TypeError(\"The bench name can't be empty\");\n    }\n    if (typeof optionsOrFn === \"function\") {\n      benchDesc = { fn: optionsOrFn, name: nameOrFnOrOptions, ...defaults };\n    } else {\n      if (!maybeFn || typeof maybeFn !== \"function\") {\n        throw new TypeError(\"Missing bench function\");\n      }\n      if (optionsOrFn.fn != undefined) {\n        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) {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_bench.js#L112-L148","documentation":"`deno uninstall` first resolves the installation directory (`$DENO_INSTALL_ROOT/bin`, default `~/.deno/bin`, honoring `--root`), then checks `fs::metadata`: if something exists at that path but it is not a directory (a regular file or symlink to a file), it aborts before touching any package shims. The check exists because the uninstall loop joins package names onto this path and would misbehave on a file.","triggerScenarios":"`deno uninstall <pkg>` when `$DENO_INSTALL_ROOT` (or `$DENO_INSTALL_ROOT/bin`, or the `--root` value) resolves to an existing non-directory: e.g. `DENO_INSTALL_ROOT=/usr/local/bin/deno` (a file), or a stray file named `bin` inside the configured root.","commonSituations":"Misconfigured `DENO_INSTALL_ROOT` in shell profile pointing at a binary instead of a directory; Docker/dotfiles that create the root incorrectly; `--root` given a file path by a wrapper script.","solutions":["Check what exists at the path: `ls -la \"$DENO_INSTALL_ROOT\"` (default `~/.deno`)","Fix `DENO_INSTALL_ROOT` to point at a real directory (deno appends `bin` unless the path already ends with it)","Remove or rename the stray file occupying the `bin` path","Pass `--root <dir>` explicitly to target the directory where the packages were actually installed"],"exampleFix":"# before (DENO_INSTALL_ROOT points at a file)\nexport DENO_INSTALL_ROOT=/usr/local/bin/deno\ndeno uninstall cowsay  # Installation path is not a directory\n\n# after\nexport DENO_INSTALL_ROOT=$HOME/.deno\ndeno uninstall cowsay  # removed","handlingStrategy":"validation","validationCode":"# Verify the install bin dir resolves to a directory before uninstalling\nBIN_DIR=\"${DENO_INSTALL_ROOT:-$HOME/.deno}\"\nBIN_DIR=\"${BIN_DIR%/bin}/bin\"\n[ -d \"$BIN_DIR\" ] || { echo \"bad install dir: $BIN_DIR\"; exit 1; }\ndeno uninstall \"$PKG\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set DENO_INSTALL_ROOT to a dedicated directory (e.g. ~/.deno) in your shell profile and never to a file path","Smoke-test new container/CI images with `deno uninstall nonexistent-pkg` expecting 'No installation found' rather than a path error","Pass `--root` explicitly in automation instead of relying on env inheritance"],"tags":["uninstall","install-root","filesystem","deno-install"],"backgroundTag":"path-is-not-a-directory","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"}