stablyai/orca · error · Error

Managed WSL Codex home does not match its persisted account

Error message

Managed WSL Codex home does not match its persisted account ID.

What it means

Thrown by assertManagedHomePath (WSL branch) when expectedAccountId is provided and the candidate linuxPath does not end with the exact segment /.local/share/orca/codex-accounts/<expectedAccountId>/home. The managed home's path must encode the account id it belongs to, so one account's home cannot be substituted for another's.

Source

Thrown at src/main/codex-accounts/service.ts:1469

      return resolvedLeft.toLowerCase() === resolvedRight.toLowerCase()
    }
    return resolvedLeft === resolvedRight
  }

  private assertManagedHomePath(candidatePath: string, expectedAccountId?: string): string {
    const wslInfo = parseWslUncPath(candidatePath)
    if (wslInfo) {
      if (
        !wslInfo.linuxPath.includes('/.local/share/orca/codex-accounts/') ||
        !wslInfo.linuxPath.endsWith('/home')
      ) {
        throw new Error('Managed WSL Codex home is outside Orca account storage.')
      }
      if (
        expectedAccountId !== undefined &&
        !wslInfo.linuxPath.endsWith(`/.local/share/orca/codex-accounts/${expectedAccountId}/home`)
      ) {
        throw new Error('Managed WSL Codex home does not match its persisted account ID.')
      }

      if (process.platform === 'win32') {
        try {
          const canonicalLinuxPath = execFileSync(
            'wsl.exe',
            [
              '-d',
              wslInfo.distro,
              '--',
              'bash',
              '-lc',
              buildEncodedWslBashCommand(
                [
                  'set -euo pipefail',
                  `candidate=${shellQuote(wslInfo.linuxPath)}`,
                  'managed_root="${HOME%/}/.local/share/orca/codex-accounts"',
                  'candidate_real=$(readlink -f -- "$candidate")',

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Regenerate the managed home for the correct account by removing and re-adding it.
  2. Audit settings.codexManagedAccounts to ensure each account's managedHomePath encodes its own id.
  3. Avoid duplicating account records or copying managed home directories between accounts.
Defensive patterns

Strategy: validation

Validate before calling

// Verify the path encodes the expected account id before trusting it.
const info = parseWslUncPath(path)
const suffix = `/.local/share/orca/codex-accounts/${accountId}/home`
if (!info || !info.linuxPath.endsWith(suffix)) {
  throw new Error('Managed home does not match the account id.')
}

Try / catch

try {
  // operation that calls assertManagedHomePath internally
  await service.reauthenticateAccount(accountId)
} catch (error) {
  if (error instanceof Error && error.message === 'Managed WSL Codex home does not match its persisted account ID.') {
    // account record mismatch — remove and re-add the account
  } else throw error
}

Prevention

When it happens

Trigger: assertManagedHomePath is called with an expectedAccountId (e.g. during login/import/reauth) but the candidate path's account-id segment differs — the home belongs to a different account id than the operation targets.

Common situations: An account record's managedHomePath was copied from another account (manual settings edit / duplicate), or an id mismatch arose from a botched migration/copy of the userData directory.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/f7ab47009fca74cd. Report an issue: GitHub.