{"record":{"id":"09bf86a1e20f68a4","repo":"oven-sh/bun","slug":"no-targets-specified-in-file-targetline","errorCode":null,"errorMessage":"No targets specified in ${file}\n> ${targetLine}\n","messagePattern":"No targets specified in (.+?)\n> (.+?)\n","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"bench/snippets/runner-entrypoint.js","lineNumber":41,"sourceCode":"  if (targetLineStart === -1) {\n    return;\n  }\n\n  const targetLineEnd = sourceContents.indexOf(\"\\n\", targetLineStart);\n  if (targetLineEnd === -1) {\n    return;\n  }\n\n  const targetLine = sourceContents.slice(targetLineStart, targetLineEnd);\n  const targets = targetLine\n    .slice(\"// @runtime \".length)\n    .split(/[,\\s]+/gm)\n    .map(a => a.trim().toLowerCase())\n    .filter(Boolean)\n    .sort();\n\n  if (targets.length === 0) {\n    throw new TypeError(\"No targets specified in \" + JSON.stringify(file) + \"\\n> \" + JSON.stringify(targetLine) + \"\\n\");\n  }\n\n  var cmds = {};\n  for (let target of targets) {\n    if (!(target in runtimes)) {\n      throw new TypeError(\n        \"Unknown target \" + JSON.stringify(target) + \"\\n> \" + targetLine + \"\\n file:\" + JSON.stringify(file),\n      );\n    }\n\n    switch (target) {\n      case \"bun\": {\n        if (!runtimes.bun) {\n          continue;\n        }\n\n        cmds.bun = [runtimes.bun, \"run\", file];\n        break;","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/snippets/runner-entrypoint.js#L23-L59","documentation":"Configuration error from the benchmark runner (bench/snippets/runner-entrypoint.js). Snippets are discovered by scanning each file for a '// @runtime ' comment; the remainder of that line is split on commas/whitespace, trimmed, lowercased, and filtered. If the resulting target list is empty, this TypeError is thrown with the file and directive line included. It means the file opted into the runner but declared no runtimes.","triggerScenarios":"A snippet containing the marker '// @runtime ' with nothing after it (or only commas/spaces that filter away); a directive accidentally emptied while editing. Note the runner scans every .js/.ts/.mjs/.tsx file in bench/snippets except files with 'runner' in the name, so any stray file with an empty directive breaks the whole scan.","commonSituations":"Adding a new bench snippet and forgetting to fill in the runtime list; reformatting or truncating the header comment; pasting a snippet that kept the marker but dropped the targets.","solutions":["Open the file named in the error and find its '// @runtime' line","Add at least one valid target after the prefix, e.g. '// @runtime bun' or '// @runtime bun,node,deno'","Re-run the runner entrypoint"],"exampleFix":"// before\n// @runtime \n\n// after\n// @runtime bun\n","handlingStrategy":"validation","validationCode":"// validate the directive before handing a file to the runner\nimport { readFileSync } from 'node:fs';\nfunction hasValidRuntimeDirective(path) {\n  const m = readFileSync(path, 'utf8').match(/^\\/\\/ @runtime (.+)$/m);\n  const targets = (m?.[1] ?? '').split(/[,\\s]+/).map(s => s.trim().toLowerCase()).filter(Boolean);\n  return targets.length > 0;\n}","typeGuard":"function parseRuntimeLine(source) {\n  const m = source.match(/^\\/\\/ @runtime (.+)$/m);\n  const targets = (m?.[1] ?? '').split(/[,\\s]+/).map(s => s.trim().toLowerCase()).filter(Boolean);\n  return targets; // non-empty array means the directive is valid\n}","tryCatchPattern":null,"preventionTips":["Always author snippets with a complete directive: '// @runtime bun' (or bun,node,deno)","Lint bench/snippets for a non-empty @runtime line in CI so one stray file cannot break the scan","Remember the runner skips files containing 'runner' in the name — any other .js/.ts/.mjs/.tsx file is scanned"],"tags":["benchmark","runner","configuration","directive"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}