oven-sh/bun · error · TypeError
Unknown target ${target} > ${targetLine} file:${file}
Error message
Unknown target ${target}
> ${targetLine}
file:${file} What it means
Configuration error from the benchmark runner: a '// @runtime' directive parsed successfully, but one of its target names is not a key of the runner's `runtimes` map, which only contains bun, node, and deno. The error includes the offending target, the full directive line, and the file. Names are trimmed and lowercased before the lookup, so only genuinely unknown/misspelled names reach this throw.
Source
Thrown at bench/snippets/runner-entrypoint.js:47
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;
}
case "node": {
if (!runtimes.node) {
continue;
}View on GitHub (pinned to 8c5296ac45)
Solutions
- Check the target name quoted in the error and correct it to bun, node, or deno
- If you need a new runtime, extend the `runtimes` map at the top of bench/snippets/runner-entrypoint.js and its switch statement
- Re-run the runner after fixing the directive
Example fix
// before // @runtime bun,nodej // after // @runtime bun,node
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN_TARGETS = new Set(['bun', 'node', 'deno']);
const targets = runtimeLine.slice('// @runtime '.length).split(/[,\s]+/).map(s => s.trim().toLowerCase()).filter(Boolean);
const bad = targets.filter(t => !KNOWN_TARGETS.has(t));
if (bad.length) throw new TypeError('Unsupported runtime target(s): ' + bad.join(', ')); Type guard
function isKnownTarget(name) {
return ['bun', 'node', 'deno'].includes(name.trim().toLowerCase());
} Prevention
- Restrict runtime lists to the names in the runtimes map at the top of runner-entrypoint.js: bun, node, deno
- When adding a new runtime to the runner, update both the map and the switch before any snippet references it
- Note that an installed-but-missing runtime (no node/deno binary) is skipped silently — only misspelled names throw, so check the quoted name carefully
When it happens
Trigger: A directive like '// @runtime bun,nodejs' (typo), '// @runtime v8' or any name outside {bun, node, deno}. Note this is about the name, not availability: a known-but-uninstalled runtime (node/deno not found) is skipped silently — only unknown names throw.
Common situations: Typos in the runtime list; targeting a runtime the runner has never heard of (workers, chrome, etc.); copy-pasting directives from a different harness.
Related errors
- No targets specified in ${file} > ${targetLine}
- 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/78b413b33617c299.
Report an issue: GitHub.