{"record":{"id":"45ae5c52b5f5c536","repo":"denoland/deno","slug":"bench-attempted-to-exit-with-exit-code-exitcode","errorCode":null,"errorMessage":"Bench attempted to exit with exit code: ${exitCode}","messagePattern":"Bench attempted to exit with exit code: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/js/40_bench.js","lineNumber":472,"sourceCode":"function wrapBenchmark(desc) {\n  const fn = desc.fn;\n  return async function outerWrapped() {\n    let token = null;\n    const originalConsole = globalThis.console;\n    currentBenchId = desc.id;\n\n    try {\n      globalThis.console = new Console((s) => {\n        op_dispatch_bench_event({ output: s });\n      });\n\n      if (desc.permissions) {\n        token = pledgePermissions(desc.permissions);\n      }\n\n      if (desc.sanitizeExit) {\n        setExitHandler((exitCode) => {\n          throw new Error(\n            `Bench attempted to exit with exit code: ${exitCode}`,\n          );\n        });\n      }\n\n      const context = createBenchContext(desc);\n      const stats = await benchMeasure(\n        fn,\n        desc,\n        context,\n      );\n\n      return { ok: stats };\n    } catch (error) {\n      return { failed: core.destructureError(error) };\n    } finally {\n      globalThis.console = originalConsole;\n      currentBenchId = null;","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_bench.js#L454-L490","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\n$ deno sync-types --config https://example.com/deno.json\n# workspace root is not a local directory\n\n# after\n$ curl -o deno.json https://example.com/deno.json\n$ deno sync-types  # writes next to the local deno.json","handlingStrategy":"validation","validationCode":"# Ensure the workspace root is local before sync-types\nCONFIG=\"${DENO_CONFIG:-deno.json}\"\ncase \"$CONFIG\" in http*|https*) echo \"remote config: vendor it locally first\"; exit 1;; esac\ndeno sync-types","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["workspace","config","sync-types","url"],"backgroundTag":"url-to-path-conversion-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}