denoland/deno · error · Error
Bench attempted to exit with exit code
Error message
Bench attempted to exit with exit code: ${exitCode} What it means
`deno sync-types` writes generated type config at the workspace root, so it converts `workspace().root_dir_url()` to a local filesystem path. `Url::to_file_path()` fails for any non-`file:` URL, which is mapped to this error. A workspace root becomes non-file when the resolved deno.json/workspace root itself lives at a remote URL.
Solutions
- Use a local deno.json as the workspace/config root for sync-types
- Vendor the remote config: download it, commit it locally, and point deno at the local copy
- Run the command from a directory whose workspace root is on the local filesystem
Example fix
# before $ deno sync-types --config https://example.com/deno.json # workspace root is not a local directory # after $ curl -o deno.json https://example.com/deno.json $ deno sync-types # writes next to the local deno.json
Defensive patterns
Strategy: validation
Validate before calling
# Ensure the workspace root is local before sync-types
CONFIG="${DENO_CONFIG:-deno.json}"
case "$CONFIG" in http*|https*) echo "remote config: vendor it locally first"; exit 1;; esac
deno sync-types Prevention
- Keep a committed local deno.json as the workspace root
- Treat remote configs as read-only inputs: vendor them for commands that write output
- Run write-capable commands from a local checkout, not from a URL-rooted context
When it happens
Trigger: Running `deno sync-types` when the workspace root URL has an http(s) scheme — e.g. deno.json was discovered via a remote config URL, or the workspace root specifier is network-based — so there is no local directory to write the generated files next to the config.
Common situations: Passing a remote config (`--config https://internal.example/deno.json`) in org setups; running from an environment where the project root resolves to a URL; exotic mounts where the root cannot be expressed as a file path.
Related errors
- A deno.json file could not be found or created
- Invalid YAML
- workspace root is not a local directory
- Both 'cert' and 'key' must be provided to enable HTTPS
- Can't convert url (" ") to filename.
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/45ae5c52b5f5c536.
Report an issue: GitHub.
Appendix: source
Thrown at cli/js/40_bench.js:472
function wrapBenchmark(desc) {
const fn = desc.fn;
return async function outerWrapped() {
let token = null;
const originalConsole = globalThis.console;
currentBenchId = desc.id;
try {
globalThis.console = new Console((s) => {
op_dispatch_bench_event({ output: s });
});
if (desc.permissions) {
token = pledgePermissions(desc.permissions);
}
if (desc.sanitizeExit) {
setExitHandler((exitCode) => {
throw new Error(
`Bench attempted to exit with exit code: ${exitCode}`,
);
});
}
const context = createBenchContext(desc);
const stats = await benchMeasure(
fn,
desc,
context,
);
return { ok: stats };
} catch (error) {
return { failed: core.destructureError(error) };
} finally {
globalThis.console = originalConsole;
currentBenchId = null;View on GitHub (pinned to 9ad36f7a2c)