{"record":{"id":"50edd2cb8957852b","repo":"stablyai/orca","slug":"codex-cli-is-not-available-in-wsl-wslinfo-distro","errorCode":null,"errorMessage":"Codex CLI is not available in WSL ${wslInfo.distro}. Install Codex in that distro or switch Account location to Windows.","messagePattern":"Codex CLI is not available in WSL (.+?)\\. Install Codex in that distro or switch Account location to Windows\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/codex-accounts/service.ts","lineNumber":1783,"sourceCode":"          )\n        })\n      }\n\n      child.stdout.on('data', appendOutput)\n      child.stderr.on('data', appendOutput)\n      child.on('error', onError)\n      child.on('close', onClose)\n    })\n  }\n\n  private assertWslCodexCliAvailable(wslInfo: { distro: string; linuxPath: string }): void {\n    try {\n      execFileSync('wsl.exe', buildWslCodexAvailabilityArgs(wslInfo.distro), {\n        encoding: 'utf-8',\n        timeout: WSL_CODEX_AVAILABILITY_TIMEOUT_MS\n      })\n    } catch (error) {\n      throw new Error(\n        `Codex CLI is not available in WSL ${wslInfo.distro}. Install Codex in that distro or switch Account location to Windows.`,\n        { cause: error }\n      )\n    }\n  }\n\n  private readIdentityFromHome(\n    managedHomePath: string,\n    expectedAccountId: string\n  ): ResolvedCodexIdentity {\n    return this.resolveIdentityFromCredentials(\n      this.loadOAuthCredentials(managedHomePath, expectedAccountId)\n    )\n  }\n\n  private resolveIdentityFromCredentials(\n    credentials: CodexOAuthCredentials\n  ): ResolvedCodexIdentity {","sourceCodeStart":1765,"sourceCodeEnd":1801,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/codex-accounts/service.ts#L1765-L1801","documentation":"Thrown by assertWslCodexCliAvailable when the probe that runs `wsl.exe` with buildWslCodexAvailabilityArgs(distro) exits non-zero, times out (WSL_CODEX_AVAILABILITY_TIMEOUT_MS), or fails to spawn. Orca requires the Codex CLI to be installed inside the target WSL distro before it will run account/login flows there; this check fails fast with an actionable message.","triggerScenarios":"Calling a flow that invokes assertWslCodexCliAvailable({distro, linuxPath}) when codex is not on PATH inside the distro, the distro is not installed/running, wsl.exe itself errors, or the availability probe exceeds its timeout.","commonSituations":"Fresh WSL distro without Codex installed; Codex installed only for the Windows host, not inside the distro; distro name typo or the distro was unregistered; slow WSL first-launch exceeding the availability timeout; PATH not exported in the distro's login shell.","solutions":["Install the Codex CLI inside the WSL distro (e.g. `wsl -d <distro> -- bash -lc '<install codex>'`) and confirm `wsl -d <distro> -- codex --version` succeeds.","Switch the Account location from WSL to Windows so Orca uses the host Codex CLI instead.","Verify the distro name is correct and registered (`wsl --list`) and that codex is on the login-shell PATH.","If WSL cold-start is slow, pre-warm the distro or increase the availability timeout only after confirming codex is actually installed."],"exampleFix":"// before: codex missing inside the distro\nsvc.assertWslCodexCliAvailable({ distro: 'Ubuntu', linuxPath }) // throws\n\n// after: install codex in the distro, then retry\n//   wsl -d Ubuntu -- bash -lc 'npm i -g @openai/codex ; codex --version'\nsvc.assertWslCodexCliAvailable({ distro: 'Ubuntu', linuxPath }) // ok","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process'\n\nfunction isCodexAvailableInDistro(distro: string): boolean {\n  try {\n    execFileSync('wsl.exe', ['-d', distro, '--', 'bash', '-lc', 'command -v codex >/dev/null 2>&1'], {\n      encoding: 'utf-8',\n      timeout: 5000\n    })\n    return true\n  } catch {\n    return false\n  }\n}\n\nif (!isCodexAvailableInDistro(distro)) {\n  // install codex in the distro, or switch account location to Windows\n}","typeGuard":"function isWslCodexUnavailableError(error: unknown): boolean {\n  return (\n    error instanceof Error &&\n    /^Codex CLI is not available in WSL /.test(error.message)\n  )\n}","tryCatchPattern":"try {\n  svc.assertWslCodexCliAvailable({ distro, linuxPath })\n} catch (error) {\n  if (isWslCodexUnavailableError(error)) {\n    // surface install instructions to the user, or fall back to Windows location\n    await provisionWithWindowsLocation()\n  } else {\n    throw error\n  }\n}","preventionTips":["Pre-install the Codex CLI in every WSL distro you intend to use for accounts.","Prefer the Windows account location unless you specifically need WSL execution.","Verify with `wsl -d <distro> -- codex --version` before adding a WSL account."],"tags":["codex-accounts","wsl","cli-availability","windows","environment"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}