denoland/deno · error · TypeError
Unexpected 'name' field in options, bench name is already…
Error message
Unexpected 'name' field in options, bench name is already provided as the first argument
What it means
`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.
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
Example fix
# before (DENO_INSTALL_ROOT points at a file) export DENO_INSTALL_ROOT=/usr/local/bin/deno deno uninstall cowsay # Installation path is not a directory # after export DENO_INSTALL_ROOT=$HOME/.deno deno uninstall cowsay # removed
Defensive patterns
Strategy: validation
Validate before calling
# Verify the install bin dir resolves to a directory before uninstalling
BIN_DIR="${DENO_INSTALL_ROOT:-$HOME/.deno}"
BIN_DIR="${BIN_DIR%/bin}/bin"
[ -d "$BIN_DIR" ] || { echo "bad install dir: $BIN_DIR"; exit 1; }
deno uninstall "$PKG" Prevention
- 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
When it happens
Trigger: `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.
Common situations: 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.
Related errors
- BenchContext::end() has already been invoked
- Could not determine directory of
- : failed to open for append
- ERR_FS_EISDIR
- ERR_FS_INVALID_SYMLINK_TYPE
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/e47d0158ca80e4ed.
Report an issue: GitHub.
Appendix: source
Thrown at cli/js/40_bench.js:130
};
if (typeof nameOrFnOrOptions === "string") {
if (!nameOrFnOrOptions) {
throw new TypeError("The bench name can't be empty");
}
if (typeof optionsOrFn === "function") {
benchDesc = { fn: optionsOrFn, name: nameOrFnOrOptions, ...defaults };
} else {
if (!maybeFn || typeof maybeFn !== "function") {
throw new TypeError("Missing bench function");
}
if (optionsOrFn.fn != undefined) {
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) {View on GitHub (pinned to 9ad36f7a2c)