denoland/deno · error · TypeError
The bench name can't be empty
Error message
The bench name can't be empty
What it means
This error is the summary error of `deno fmt --check`: after all files are processed, `finish()` compares an atomic counter of files whose dprint-formatted output differs from their on-disk content. If at least one file is not formatted, deno exits non-zero with this message. It only fires in check mode; a normal `deno fmt` run rewrites the files instead of counting them.
Solutions
- Run `deno fmt` at the repo root to rewrite all files, then commit the changes
- If a generated/vendored file is flagged, add its directory to `"fmt": { "exclude": [...] }` in deno.json or pass `--ignore`
- Make codegen pipelines pipe their output through `deno fmt` before writing
- Pin the same Deno version locally and in CI (e.g. via `deno upgrade --version` or dprint.json pins) so formatting output is identical
Example fix
# before (CI fails) deno fmt --check # Found 3 not formatted files in 42 files # after deno fmt git commit -am "format" deno fmt --check # passes
Defensive patterns
Strategy: validation
Validate before calling
# CI: format first, then verify — makes the check deterministic Deno 1.x: in a CI step run deno fmt --check || (echo '::error::run `deno fmt` locally' && exit 1)
Prevention
- Add a pre-commit or pre-push hook that runs `deno fmt`
- Run `deno fmt` in the same CI job that runs `--check`, before checking
- Exclude generated/vendored directories in deno.json fmt config so they can never fail the gate
- Pin one Deno version across the team (e.g. `dprint` plugin versions follow it) to avoid formatting drift
When it happens
Trigger: Running `deno fmt --check` (directly or from CI/pre-commit hooks) when any collected file's formatted output differs from disk. The counter is incremented per-file, so a single edited-but-unformatted file triggers it. Files come from the fmt include/exclude config in deno.json plus CLI args.
Common situations: CI formatting gate failing because the developer forgot to run `deno fmt` locally; different Deno/dprint plugin versions between machines producing different output; generated code (codegen, snapshots, vendored files) that is never run through the formatter; editors saving with different line endings or adding/removing a trailing newline.
Related errors
- Missing bench function
- Panic formatting
- Bench failed because the "only" option was used
- BenchContext::end() has already been invoked
- codesigning requires a macOS build host (uses…
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/885b88194abc013c.
Report an issue: GitHub.
Appendix: source
Thrown at cli/js/40_bench.js:116
warmupBenchDesc.warmup,
registerBenchIdRetBufU8,
);
warmupBenchDesc.id = registerBenchIdRetBufU8[0];
warmupBenchDesc.origin = cachedOrigin;
}
let benchDesc;
const defaults = {
ignore: false,
baseline: false,
only: false,
sanitizeExit: true,
permissions: null,
};
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 = {View on GitHub (pinned to 9ad36f7a2c)