oven-sh/bun · error · TypeError
No targets specified in ${file} > ${targetLine}
Error message
No targets specified in ${file}
> ${targetLine}
What it means
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.
Source
Thrown at bench/snippets/runner-entrypoint.js:41
if (targetLineStart === -1) {
return;
}
const targetLineEnd = sourceContents.indexOf("\n", targetLineStart);
if (targetLineEnd === -1) {
return;
}
const targetLine = sourceContents.slice(targetLineStart, targetLineEnd);
const targets = targetLine
.slice("// @runtime ".length)
.split(/[,\s]+/gm)
.map(a => a.trim().toLowerCase())
.filter(Boolean)
.sort();
if (targets.length === 0) {
throw new TypeError("No targets specified in " + JSON.stringify(file) + "\n> " + JSON.stringify(targetLine) + "\n");
}
var cmds = {};
for (let target of targets) {
if (!(target in runtimes)) {
throw new TypeError(
"Unknown target " + JSON.stringify(target) + "\n> " + targetLine + "\n file:" + JSON.stringify(file),
);
}
switch (target) {
case "bun": {
if (!runtimes.bun) {
continue;
}
cmds.bun = [runtimes.bun, "run", file];
break;View on GitHub (pinned to 8c5296ac45)
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
Example fix
// before // @runtime // after // @runtime bun
Defensive patterns
Strategy: validation
Validate before calling
// validate the directive before handing a file to the runner
import { readFileSync } from 'node:fs';
function hasValidRuntimeDirective(path) {
const m = readFileSync(path, 'utf8').match(/^\/\/ @runtime (.+)$/m);
const targets = (m?.[1] ?? '').split(/[,\s]+/).map(s => s.trim().toLowerCase()).filter(Boolean);
return targets.length > 0;
} Type guard
function parseRuntimeLine(source) {
const m = source.match(/^\/\/ @runtime (.+)$/m);
const targets = (m?.[1] ?? '').split(/[,\s]+/).map(s => s.trim().toLowerCase()).filter(Boolean);
return targets; // non-empty array means the directive is valid
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown target ${target} > ${targetLine} file:${file}
- Second buffer was modified
- Third buffer was modified
- bad result
- Expected ${expected} to be ${equal} for ${description}
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/09bf86a1e20f68a4.
Report an issue: GitHub.