{"record":{"id":"037b81f3c383ef92","repo":"stablyai/orca","slug":"electron-trial-exhausted-launcher-attempts","errorCode":null,"errorMessage":"Electron trial exhausted launcher attempts","messagePattern":"Electron trial exhausted launcher attempts","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/hang-watchdog-memory-benchmark.mjs","lineNumber":357,"sourceCode":"      })\n    } finally {\n      rmSync(launcherDir, { recursive: true, force: true })\n    }\n    if (result.status !== 0) {\n      throw new Error(\n        `Electron trial failed (${result.error?.message ?? result.signal ?? result.status}):\\n` +\n          `${result.stderr || result.stdout}`\n      )\n    }\n    const line = result.stdout.split('\\n').find((candidate) => candidate.startsWith(RESULT_PREFIX))\n    if (line) {\n      return { ...JSON.parse(line.slice(RESULT_PREFIX.length)), launchAttempts: attempt }\n    }\n    if (attempt === MAX_LAUNCH_ATTEMPTS || result.stderr || result.stdout) {\n      throw new Error(`Electron trial did not report a result (status ${result.status})`)\n    }\n  }\n  throw new Error('Electron trial exhausted launcher attempts')\n}\n\nfunction runBenchmark() {\n  if (process.platform !== 'darwin') {\n    throw new Error('The production watchdog is macOS-only; run this benchmark on macOS')\n  }\n  if (!existsSync(entryPath)) {\n    throw new Error(`Missing ${entryPath}; run pnpm exec electron-vite build first`)\n  }\n  const options = parseArgs(process.argv.slice(2))\n  const builtEntry = readFileSync(entryPath, 'utf8')\n  const hasChildContract = builtEntry.includes('ORCA_HANG_WATCHDOG_PARENT_PID')\n  const hasWorkerContract = builtEntry.includes('workerData') && builtEntry.includes('parentPort')\n  if (\n    (options.boundary === 'child' && !hasChildContract) ||\n    (options.boundary === 'worker' && !hasWorkerContract)\n  ) {\n    throw new Error(","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/hang-watchdog-memory-benchmark.mjs#L339-L375","documentation":"Terminal throw at the end of runTrial's retry loop, reached only if all MAX_LAUNCH_ATTEMPTS (3) attempts returned status 0 with no RESULT_PREFIX line AND no stderr AND no stdout. The loop's inner conditions would normally throw [69] on the final attempt or whenever noise is present; this line is a defensive guard for the silent-failure case where every attempt produces a clean but empty output.","triggerScenarios":"Electron launches and exits 0 but prints absolutely nothing on all three attempts — e.g. the launcher main.cjs import resolved to a no-op, the script was stubbed, or stdout is fully swallowed by the environment (buffering/pipe closure).","commonSituations":"Misconfigured test harness that replaces the script with a stub, CI runners that close/redirect stdout, or an Electron build that exits cleanly before reaching runInternal.","solutions":["Run the launcher manually to see whether runInternal is reached at all.","Confirm the script file is the real benchmark and not a stub/empty file.","Check that stdout is not redirected or consumed by a wrapper in CI.","Rebuild the entry and verify electronPath() resolves a working binary."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: run the launcher once manually to confirm runInternal produces output\nconst probe = spawnSync(executable, ['--js-flags=--expose-gc', launcherDir], { encoding: 'utf8', timeout: 90_000 })\nif (probe.status === 0 && !probe.stdout.includes(RESULT_PREFIX)) {\n  throw new Error('launcher produces no RESULT line; script may be stubbed or stdout redirected')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the script file is the real benchmark, not a stub.","Ensure CI does not redirect or swallow the child process stdout."],"tags":["benchmark","electron","spawn","retry","silent-failure"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}