{"record":{"id":"6d913717186ee109","repo":"stablyai/orca","slug":"config-scripts-install-electron-package-binary-mjs","errorCode":null,"errorMessage":"config/scripts/install-electron-package-binary.mjs exited with status ${result.status}","messagePattern":"config/scripts/install-electron-package-binary\\.mjs exited with status (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/rebuild-native-deps.mjs","lineNumber":268,"sourceCode":"  const env = { ...process.env }\n  delete env.ELECTRON_SKIP_BINARY_DOWNLOAD\n  delete env.npm_config_electron_skip_binary_download\n\n  const result = spawnSync(\n    process.execPath,\n    ['config/scripts/install-electron-package-binary.mjs'],\n    {\n      cwd: projectDir,\n      env,\n      stdio: 'inherit'\n    }\n  )\n\n  if (result.error) {\n    throw result.error\n  }\n  if (result.status !== 0) {\n    throw new Error(\n      `config/scripts/install-electron-package-binary.mjs exited with status ${result.status}`\n    )\n  }\n}\n\nfunction resetPartialElectronInstall() {\n  // Why: Electron's installer can leave a partial dist/ tree behind after\n  // skipped or interrupted postinstall runs; retry from a clean target.\n  rmSync(resolve(electronPackageDir, 'dist'), { recursive: true, force: true })\n  rmSync(resolve(electronPackageDir, 'path.txt'), { force: true })\n}\n\nfunction continuePostinstallWithoutElectron() {\n  if (!isPostinstall() || process.env.ORCA_STRICT_ELECTRON_INSTALL === '1') {\n    return false\n  }\n  console.error(\n    '[rebuild] Continuing postinstall because Electron binary installation failed. ' +","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/rebuild-native-deps.mjs#L250-L286","documentation":"Thrown by runElectronPackageBinaryInstall in config/scripts/rebuild-native-deps.mjs when the child script config/scripts/install-electron-package-binary.mjs exits with a non-zero status (and spawnSync itself did not error — that path rethrows result.error instead). The child script downloads and extracts the Electron binary; a non-zero exit means the download/extract failed and Electron's dist tree is not usable.","triggerScenarios":"The Electron binary download fails due to network error, a mirror returning 403/404, a checksum mismatch, or the install script hitting an out-of-disk condition. spawnSync returns status != 0, no result.error, and line 267-270 throws this message embedding the exit status.","commonSituations":"Flaky CI networks during Electron downloads, an unreachable ELECTRON_MIRROR, npm's electron binary cache corruption, or a transient GitHub/CDN outage. Electron downloads are notoriously intermittent, so this surfaces most often in CI.","solutions":["Retry the rebuild — Electron download failures are usually transient.","Set ELECTRON_MIRROR or ELECTRON_CUSTOM_DIR to a reachable mirror if GitHub's CDN is blocked.","Clear the Electron cache (rm node_modules/electron/dist + path.txt) and reinstall to rule out a corrupted partial extract."],"exampleFix":"// before\nnode config/scripts/rebuild-native-deps.mjs\n# install-electron-package-binary.mjs exited with status 1\n\n// after\n# retry; if persistent, point at a mirror\nELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ node config/scripts/rebuild-native-deps.mjs","handlingStrategy":"retry","validationCode":"// Pre-flight: confirm Electron can be reached. The download itself is not\n// guaranteed, but a reachable mirror reduces transient failures.\nif (process.env.ELECTRON_MIRROR) {\n  const ok = await fetch(process.env.ELECTRON_MIRROR).then((r) => r.ok).catch(() => false)\n  if (!ok) throw new Error(`ELECTRON_MIRROR unreachable: ${process.env.ELECTRON_MIRROR}`)\n}","typeGuard":null,"tryCatchPattern":"for (let attempt = 0; attempt < maxRetries; attempt++) {\n  try {\n    runElectronPackageBinaryInstall()\n    break\n  } catch (err) {\n    if (attempt === maxRetries - 1) throw err\n    await backoff(attempt)\n  }\n}","preventionTips":["Retry Electron downloads — failures are usually transient network blips.","Set ELECTRON_MIRROR to a reachable mirror when GitHub's CDN is blocked.","Clear node_modules/electron/dist + path.txt before retrying to avoid partial extracts."],"tags":["electron","build","network","native","download"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}