{"record":{"id":"ecd73a132d022fdc","repo":"denoland/deno","slug":"missing-bench-function","errorCode":null,"errorMessage":"Missing bench function","messagePattern":"Missing bench function","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"cli/js/40_bench.js","lineNumber":122,"sourceCode":"\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 = {\n        ...defaults,\n        ...optionsOrFn,\n        fn: maybeFn,\n        name: nameOrFnOrOptions,\n      };\n    }","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_bench.js#L104-L140","documentation":"This is `deno fmt`'s summary error for files that could not be formatted at all, as opposed to files that merely need formatting. Per-file failures (parse errors, unreadable files, decode failures) increment `failed_files_count`, and `finish()` reports how many of the checked files errored. The details of each failure are printed above the summary during the run.","triggerScenarios":"Any matched file raises while formatting: a TypeScript/JavaScript/JSON/JSONC/Markdown file with a syntax error the dprint plugin cannot parse, a file that cannot be read (permissions), or a file whose contents cannot be decoded. Note the summary counts both, so run without `--check` to see each per-file error message.","commonSituations":"A half-finished refactor left a syntax error in a file that fmt scans; a JSON file with trailing commas or comments outside the configured plugin expectations; a file locked by another process on Windows; merge-conflict markers (`<<<<<<<`) left in a source file.","solutions":["Run `deno fmt` without `--check` and read the per-file error lines printed above the summary; fix the reported syntax error","Isolate the broken file with `deno fmt path/to/file.ts` to see its full error","Search for leftover conflict markers (`grep -rn '<<<<<<<'`) after a messy merge","If the file should not be formatted, exclude it via `\"fmt\": { \"exclude\": [...] }` in deno.json"],"exampleFix":"# before\n$ deno fmt\n# Error formatting .../broken.ts: Unexpected token\n# Failed to format 1 of 12 checked files\n\n# after (fix the syntax error in broken.ts, e.g. remove stray comma)\n$ deno fmt  # ok","handlingStrategy":"try-catch","validationCode":"# Surface per-file errors before the summary by running fmt verbosely\ndeno fmt 2>&1 | grep -B1 'Error formatting' || true","typeGuard":null,"tryCatchPattern":"In scripts wrapping the CLI, run fmt without --check, capture exit code, and treat 'Failed to format N of M' as a per-file error signal: re-run `deno fmt <file>` for each file named above the summary to get the underlying syntax error, fix it, then retry the full run.","preventionTips":["Run `deno fmt` locally before pushing so syntax errors surface immediately","Configure editors to format-on-save with deno","After merges, grep for conflict markers (`<<<<<<<`) which break parsing","Keep JSON fixtures either valid or excluded from fmt"],"tags":["formatting","syntax-error","dprint","fmt"],"backgroundTag":"file-parse-error","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}