{"record":{"id":"885b88194abc013c","repo":"denoland/deno","slug":"the-bench-name-can-t-be-empty","errorCode":null,"errorMessage":"The bench name can't be empty","messagePattern":"The bench name can't be empty","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"cli/js/40_bench.js","lineNumber":116,"sourceCode":"      warmupBenchDesc.warmup,\n      registerBenchIdRetBufU8,\n    );\n    warmupBenchDesc.id = registerBenchIdRetBufU8[0];\n    warmupBenchDesc.origin = cachedOrigin;\n  }\n\n  let benchDesc;\n  const defaults = {\n    ignore: false,\n    baseline: false,\n    only: false,\n    sanitizeExit: true,\n    permissions: null,\n  };\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 = {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/js/40_bench.js#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-invoke with both required arguments: ./trace_runner <generator_pid> <command> [args...], e.g. ./trace_runner 4242 ./target/release/deno run -A workload.ts","If wrapped in a script, verify the command array is non-empty before spawning the runner and quote all expansions","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","Treat child exit code 2 from the runner as a usage error and surface the stderr text in your wrapper's diagnostics"],"exampleFix":"# before\n$ ./trace_runner 4242\nusage: ./trace_runner GENERATOR_PID COMMAND [ARGS...]   # exit 2\n\n# after\n$ ./trace_runner 4242 ./target/release/deno eval '1'   # PID + command","handlingStrategy":"validation","validationCode":"# bash wrapper: enforce the runner's contract before exec'ing it\nif [ \"$#\" -lt 2 ]; then\n  echo \"usage: $0 GENERATOR_PID COMMAND [ARGS...]\" >&2\n  exit 2\nfi\nexec \"$TRACE_RUNNER\" \"$@\"","typeGuard":null,"tryCatchPattern":"// TS driver: distinguish usage errors (exit 2) from other failures\nconst status = await new Deno.Command(runner, { args: [genPid, bin, ...args], env }).spawn().status;\nif (status.code === 2) throw new Error(`trace runner usage error: pass GENERATOR_PID COMMAND [ARGS...]`);","preventionTips":["Always spawn the runner through the generate_*_function_orderfile.ts drivers rather than by hand","In wrappers, check the positional-argument count before delegating to the runner","Never build the runner's argv from unquoted or possibly-empty shell expansions","Map exit code 2 from the runner to a clear 'bad invocation' diagnostic in your tooling"],"tags":["cli","arguments","usage","process","exit-code-2"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}