{"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/89f33cbef296a2b287f323d42de54c871fa69c77/cli/js/40_bench.js#L454-L490","documentation":"LAUFEY_DEV_DIR is set, so Deno resolves the laufey backend from a local source checkout instead of the download cache — but no built backend binary could be located under that checkout, so resolution aborts before falling back to a download.","triggerScenarios":"Setting LAUFEY_DEV_DIR to a laufey source checkout that has not been built (`cargo build --release` not run) or whose build output is in a non-default/absent location.","commonSituations":"Developers iterating on laufey itself and forgetting to rebuild after pulling; pointing the env var at a stale or partial clone.","solutions":["Build the checkout (`cargo build --release` in the laufey repo) and re-run","Verify the expected backend binary exists under the checkout's build output","If dev mode was unintended, unset LAUFEY_DEV_DIR so the cached/fresh download path is used"],"exampleFix":"# before\nexport LAUFEY_DEV_DIR=~/src/laufey   # not built yet\ndeno desktop --hmr\n\n# after\ncargo build --release --manifest-path ~/src/laufey/Cargo.toml\ndeno desktop --hmr","handlingStrategy":"validation","validationCode":"const devDir = Deno.env.get('LAUFEY_DEV_DIR');\nif (devDir && !await exists(`${devDir}/target/release/laufey`)) {\n  throw new Error('LAUFEY_DEV_DIR set but laufey not built — run cargo build --release first');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build laufey before setting LAUFEY_DEV_DIR, and rebuild after every pull","Add a preflight check for the binary whenever dev mode is enabled","Unset LAUFEY_DEV_DIR when you did not mean to use a local checkout"],"tags":["desktop","laufey","environment","build","dev-dir"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}