stablyai/orca · error · Error
Could not resolve the active WSL home directory for Codex lo
Error message
Could not resolve the active WSL home directory for Codex login.
What it means
Thrown by tryCreateWslManagedHome when probing the active WSL distro's $HOME via wsl.exe failed to yield a usable distro name and a Linux home path starting with '/'. Orca builds the managed WSL Codex home under $HOME/.local/share/orca/codex-accounts/<id>/home, so both values are required before it creates anything.
Source
Thrown at src/main/codex-accounts/service.ts:1173
): ManagedHomeLocation | null {
if (process.platform !== 'win32' || target?.runtime !== 'wsl') {
return null
}
const distroArgs = target.wslDistro?.trim() ? ['-d', target.wslDistro.trim()] : []
const infoOutput = execFileSync(
'wsl.exe',
[...distroArgs, '--', 'bash', '-lc', 'printf "%s\\n%s\\n" "$WSL_DISTRO_NAME" "$HOME"'],
{ encoding: 'utf-8', timeout: 5000 }
)
const [rawDistro, rawHome] = infoOutput
.replaceAll(String.fromCharCode(0), '')
.split(/\r?\n/)
.map((line) => line.trim())
const distro = target.wslDistro?.trim() || rawDistro
const home = rawHome
if (!distro || !home?.startsWith('/')) {
throw new Error('Could not resolve the active WSL home directory for Codex login.')
}
const wslLinuxHomePath = `${home.replace(/\/$/, '')}/.local/share/orca/codex-accounts/${accountId}/home`
const markerPath = `${wslLinuxHomePath}/.orca-managed-home`
execFileSync(
'wsl.exe',
[
'-d',
distro,
'--',
'bash',
'-lc',
`mkdir -p ${shellQuote(wslLinuxHomePath)} && printf '%s\\n' ${shellQuote(accountId)} > ${shellQuote(markerPath)}`
],
{ encoding: 'utf-8', timeout: 5000 }
)
const managedHomePath = toWindowsWslPath(wslLinuxHomePath, distro)View on GitHub (pinned to 1136503c6a)
Solutions
- Confirm WSL is installed and a distro is registered: run `wsl -l -v` and ensure the target distro is default/listed.
- Verify the distro's `bash -lc 'echo $HOME'` prints an absolute Linux path; fix the shell profile if HOME is unset.
- Pass the explicit distro via target.wslDistro so Orca does not rely on the default distro resolution.
- If WSL is unavailable, add the account under the host runtime instead.
Example fix
# before: WSL distro has no usable HOME
wsl.exe -d BrokenDistro -- bash -lc 'echo $HOME' # empty / unset
service.addAccount({ runtime: 'wsl', wslDistro: 'BrokenDistro' }) # throws [914]
# after: fix the distro profile so HOME resolves, or pick a healthy distro
echo 'export HOME=$(/usr/bin/getent passwd $(id -un) | cut -d: -f6)' >> ~/.bashrc
service.addAccount({ runtime: 'wsl', wslDistro: 'Ubuntu' }) Defensive patterns
Strategy: fallback
Validate before calling
// Probe WSL HOME/distro before attempting a WSL account add.
import { execFileSync } from 'node:child_process'
function probeWslHome(distro?: string): { distro: string; home: string } | null {
try {
const out = execFileSync('wsl.exe', [...(distro ? ['-d', distro] : []), '--', 'bash', '-lc',
'printf "%s\\n%s" "$WSL_DISTRO_NAME" "$HOME"'], { encoding: 'utf-8', timeout: 5000 })
const [d, h] = out.replaceAll(String.fromCharCode(0), '').split(/\r?\n/).map(s => s.trim())
return d && h?.startsWith('/') ? { distro: d, home: h } : null
} catch { return null }
}
if (!probeWslHome(target.wslDistro)) { /* fall back to host or surface WSL setup error */ } Try / catch
try {
await service.addAccount({ runtime: 'wsl', wslDistro })
} catch (error) {
if (error instanceof Error && error.message.includes('WSL home directory')) {
// fall back to host runtime or guide WSL setup
await service.addAccount()
} else throw error
} Prevention
- Ensure a healthy WSL distro with a resolving $HOME is registered before adding WSL accounts.
- Pass target.wslDistro explicitly rather than relying on the default distro.
When it happens
Trigger: Adding a Codex account with target.runtime 'wsl' on Windows; wsl.exe printed output that, after null-stripping and trimming, has an empty distro or a HOME that does not start with '/' (e.g. wsl.exe unavailable, returned an error string, or HOME unset in the distro profile).
Common situations: WSL not installed / no distro registered (wsl.exe errors to stdout), the requested --wslDistro does not exist, the distro's shell profile clears/unsets HOME, or a non-standard login shell that suppresses the printf output.
Related errors
- Codex CLI is not available in WSL ${wslInfo.distro}. Install
- No user WSL distro found. Install/enable WSL or pass --distr
- Could not resolve the active WSL home directory for Claude l
- This benchmark requires a Windows host with WSL
- invalid_argument
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/26c3721378219623.
Report an issue: GitHub.