denoland/deno · error · TypeError

The bench name can't be empty

Error message

The bench name can't be empty

What it means

This is the argument-count guard at the top of main() in tools/startup_order/orderfile_trace_runner.c. The runner needs at least two positional arguments: the PID of the Deno-based orderfile generator process (which it SIGSTOPs while the traced workload runs, so the generator's V8 threads do not perturb first-touch ordering) and the command to execute under the function tracer. When argc < 3 it prints 'usage: <argv[0]> GENERATOR_PID COMMAND [ARGS...]' to stderr and exits with code 2.

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 89f33cbef2)

Solutions

  1. Re-invoke with both required arguments: ./trace_runner <generator_pid> <command> [args...], e.g. ./trace_runner 4242 ./target/release/deno run -A workload.ts
  2. If wrapped in a script, verify the command array is non-empty before spawning the runner and quote all expansions
  3. Prefer not invoking the runner manually at all - drive it through tools/startup_order/generate_linux_function_orderfile.ts or generate_macos_function_orderfile.ts, which assemble the arguments correctly
  4. Treat child exit code 2 from the runner as a usage error and surface the stderr text in your wrapper's diagnostics

Example fix

# before
$ ./trace_runner 4242
usage: ./trace_runner GENERATOR_PID COMMAND [ARGS...]   # exit 2

# after
$ ./trace_runner 4242 ./target/release/deno eval '1'   # PID + command
Defensive patterns

Strategy: validation

Validate before calling

# bash wrapper: enforce the runner's contract before exec'ing it
if [ "$#" -lt 2 ]; then
  echo "usage: $0 GENERATOR_PID COMMAND [ARGS...]" >&2
  exit 2
fi
exec "$TRACE_RUNNER" "$@"

Try / catch

// TS driver: distinguish usage errors (exit 2) from other failures
const status = await new Deno.Command(runner, { args: [genPid, bin, ...args], env }).spawn().status;
if (status.code === 2) throw new Error(`trace runner usage error: pass GENERATOR_PID COMMAND [ARGS...]`);

Prevention

When it happens

Trigger: Invoking the compiled trace_runner binary with no arguments, or with a generator PID but no COMMAND (e.g. './trace_runner 4242'). Within the pipeline this is nearly impossible: the TS drivers always spawn [runner, String(Deno.pid), binary, ...workload.args] (generate_linux_function_orderfile.ts:492-496), so the error is produced by manual or scripted invocation of the helper outside that driver.

Common situations: Debugging the orderfile tooling by hand and running the runner directly; a wrapper script whose positional arguments were dropped by quoting mistakes or an unset variable ($1 expanding to nothing); copy-pasting an invocation from shell history where quoted args were lost.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/885b88194abc013c. Report an issue: GitHub.