{"record":{"id":"7f2cd33eebfc062a","repo":"stablyai/orca","slug":"etimedout-7f2cd3","errorCode":"ETIMEDOUT","errorMessage":"Timed out running ${command}","messagePattern":"Timed out running (.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/ipc/preflight-command-exec.ts","lineNumber":28,"sourceCode":"const execFileAsync = promisify(execFile)\nexport const PREFLIGHT_COMMAND_TIMEOUT_MS = 5000\nconst WSL_COMMAND_PATH_SENTINEL = '__ORCA_PREFLIGHT_COMMAND_PATH__'\n\nexport type PreflightCommandResult = { stdout: string; stderr: string }\n\nexport function shellQuote(value: string): string {\n  return `'${value.replace(/'/g, \"'\\\\''\")}'`\n}\n\nasync function withPreflightTimeout<T>(command: string, commandPromise: Promise<T>): Promise<T> {\n  let timeout: ReturnType<typeof setTimeout> | null = null\n  try {\n    return await Promise.race([\n      commandPromise,\n      new Promise<never>((_resolve, reject) => {\n        timeout = setTimeout(() => {\n          const error = Object.assign(new Error(`Timed out running ${command}`), {\n            code: 'ETIMEDOUT'\n          })\n          reject(error)\n        }, PREFLIGHT_COMMAND_TIMEOUT_MS)\n        if (typeof timeout.unref === 'function') {\n          timeout.unref()\n        }\n      })\n    ])\n  } finally {\n    if (timeout) {\n      clearTimeout(timeout)\n    }\n  }\n}\n\nexport async function execLocalPreflightCommand(\n  command: string,\n  args: string[]","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/preflight-command-exec.ts#L10-L46","documentation":"Thrown by withPreflightTimeout (preflight-command-exec.ts:20-42) when a preflight command does not settle within PREFLIGHT_COMMAND_TIMEOUT_MS (5000 ms). It races the command promise against a setTimeout; on timeout it rejects with an Error carrying code 'ETIMEDOUT'. The timeout.unref() call (line 32) means the timer does not keep the Node event loop alive. Used by execLocalPreflightCommand and execCommandInWsl to probe tools like git --version before relying on them.","triggerScenarios":"A preflight probe such as 'git --version' or a WSL path lookup script hangs past 5 seconds: the executable prompts for input, is gated by privilege-management software (the file references this at preflight-command-exec.ts:85-89), waits on a slow network mount, or the WSL distro is slow to start.","commonSituations":"Privilege-management/corporate EDR gating each process spawn; a slow WSL cold start; a git credential helper blocking on a keychain prompt; an antivirus scanning the spawned binary; a hung NFS/Home directory path on PATH resolution.","solutions":["Run the failing command manually in a terminal with 'time' to confirm it is slow or interactive, then fix the root cause (e.g. disable an interactive credential prompt).","For WSL, ensure the distro is already running (wsl --list --running) to avoid cold-start latency.","Add exemptions for the toolchain in privilege-management/antivirus software.","If the command is inherently slow on this host, the preflight is working as designed — treat the tool as unavailable for preflight purposes (callers fall back).","Note execFileAsync also has its own timeout=PREFLIGHT_COMMAND_TIMEOUT_MS (line 51), so the child is killed at 5s regardless."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isPreflightTimeout(e: unknown): e is Error & { code: 'ETIMEDOUT' } {\n  return e instanceof Error && (e as { code?: string }).code === 'ETIMEDOUT'\n}","tryCatchPattern":"try {\n  await execLocalPreflightCommand(cmd, args)\n} catch (e) {\n  if (isPreflightTimeout(e)) {\n    // tool is effectively unavailable for preflight; fall back to a non-preflight path or report unavailable\n  } else throw e\n}","preventionTips":["Treat preflight as advisory — its callers (isCommandAvailable, isCommandOnPath) already swallow errors and return false, so let them.","Keep WSL distros warm to avoid cold-start latency under the 5s budget.","Add toolchain paths to antivirus/EDR exemptions to avoid per-spawn gating."],"tags":["preflight","timeout","etimedout","process-spawn","wsl"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}