{"record":{"id":"25d0e3b66572a3b7","repo":"stablyai/orca","slug":"electron-trial-failed-result-error-message","errorCode":null,"errorMessage":"Electron trial failed (${result.error?.message ?? result.signal ?? result.status}):\\n${result.stderr || result.stdout}","messagePattern":"Electron trial failed \\((.+?)\\):\\\\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/hang-watchdog-memory-benchmark.mjs","lineNumber":344,"sourceCode":"      path.join(launcherDir, 'main.cjs'),\n      `import(${JSON.stringify(pathToFileURL(scriptPath).href)}).catch((error) => {\n  console.error(error)\n  process.exitCode = 1\n})\\n`\n    )\n    let result\n    try {\n      result = spawnSync(executable, ['--js-flags=--expose-gc', launcherDir], {\n        cwd: repoRoot,\n        env,\n        encoding: 'utf8',\n        timeout: 90_000\n      })\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')","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/hang-watchdog-memory-benchmark.mjs#L326-L362","documentation":"Thrown by runTrial when the spawned Electron process exits with a non-zero status. The message includes the error message, signal, or status code and dumps stderr/stdout for diagnosis. This indicates Electron crashed, failed to launch, or the in-Electron runInternal path threw (e.g. the watchdog build verification or a measurement step).","triggerScenarios":"Electron fails to start (missing binary, display/GPU issues), the built watchdog entry throws at runtime, the macOS footprint tool is unavailable, or an assertion inside runInternal/measureChild/measureWorker fails. The launcher main.cjs imports the script and sets process.exitCode=1 on any import error.","commonSituations":"Broken Electron install, missing or stale built entry (out/main/main-thread-hang-watchdog-entry.js), macOS permission issues blocking /usr/bin/footprint, or a real regression in the watchdog code under test.","solutions":["Read the embedded stderr/stdout in the error message — it contains the underlying Electron-side exception.","Rebuild the entry: `pnpm exec electron-vite build`, then re-run.","Confirm the Electron binary resolves (electronPath() succeeds) and macOS tooling (`/usr/bin/footprint`, `ps`) is accessible.","If the error names a watchdog verification failure, investigate the watchdog implementation, not the harness."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm Electron resolves and the entry is built\nimport { existsSync } from 'node:fs'\nif (!existsSync(entryPath)) throw new Error(`build missing: ${entryPath}`)\nconst executable = electronPath()  // throws early if Electron is unresolvable","typeGuard":null,"tryCatchPattern":"try {\n  await runTrial(executable, boundary)\n} catch (error) {\n  const msg = error instanceof Error ? error.message : String(error)\n  // Surface the embedded Electron stderr for diagnosis, then decide retry vs fail\n  if (msg.includes('did not report a result') || msg.includes('trial failed')) {\n    console.error('Electron trial failed; inspect stderr above. Rebuild with: pnpm exec electron-vite build')\n  }\n  throw error\n}","preventionTips":["Rebuild the entry before every benchmark run to avoid stale-artifact crashes.","Read the embedded stderr/stdout in the error message — the root cause is there.","Confirm macOS tooling (/usr/bin/footprint, ps) is accessible on the runner."],"tags":["benchmark","electron","spawn","watchdog","diagnostics"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}