{"record":{"id":"f7ab47009fca74cd","repo":"stablyai/orca","slug":"managed-wsl-codex-home-does-not-match-its-persiste","errorCode":null,"errorMessage":"Managed WSL Codex home does not match its persisted account ID.","messagePattern":"Managed WSL Codex home does not match its persisted account ID\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/codex-accounts/service.ts","lineNumber":1469,"sourceCode":"      return resolvedLeft.toLowerCase() === resolvedRight.toLowerCase()\n    }\n    return resolvedLeft === resolvedRight\n  }\n\n  private assertManagedHomePath(candidatePath: string, expectedAccountId?: string): string {\n    const wslInfo = parseWslUncPath(candidatePath)\n    if (wslInfo) {\n      if (\n        !wslInfo.linuxPath.includes('/.local/share/orca/codex-accounts/') ||\n        !wslInfo.linuxPath.endsWith('/home')\n      ) {\n        throw new Error('Managed WSL Codex home is outside Orca account storage.')\n      }\n      if (\n        expectedAccountId !== undefined &&\n        !wslInfo.linuxPath.endsWith(`/.local/share/orca/codex-accounts/${expectedAccountId}/home`)\n      ) {\n        throw new Error('Managed WSL Codex home does not match its persisted account ID.')\n      }\n\n      if (process.platform === 'win32') {\n        try {\n          const canonicalLinuxPath = execFileSync(\n            'wsl.exe',\n            [\n              '-d',\n              wslInfo.distro,\n              '--',\n              'bash',\n              '-lc',\n              buildEncodedWslBashCommand(\n                [\n                  'set -euo pipefail',\n                  `candidate=${shellQuote(wslInfo.linuxPath)}`,\n                  'managed_root=\"${HOME%/}/.local/share/orca/codex-accounts\"',\n                  'candidate_real=$(readlink -f -- \"$candidate\")',","sourceCodeStart":1451,"sourceCodeEnd":1487,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/codex-accounts/service.ts#L1451-L1487","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Regenerate the managed home for the correct account by removing and re-adding it.","Audit settings.codexManagedAccounts to ensure each account's managedHomePath encodes its own id.","Avoid duplicating account records or copying managed home directories between accounts."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the path encodes the expected account id before trusting it.\nconst info = parseWslUncPath(path)\nconst suffix = `/.local/share/orca/codex-accounts/${accountId}/home`\nif (!info || !info.linuxPath.endsWith(suffix)) {\n  throw new Error('Managed home does not match the account id.')\n}","typeGuard":null,"tryCatchPattern":"try {\n  // operation that calls assertManagedHomePath internally\n  await service.reauthenticateAccount(accountId)\n} catch (error) {\n  if (error instanceof Error && error.message === 'Managed WSL Codex home does not match its persisted account ID.') {\n    // account record mismatch — remove and re-add the account\n  } else throw error\n}","preventionTips":["Never duplicate or copy account records/managed homes between account ids.","If migrating userData, ensure each account's path encodes its own id."],"tags":["codex-accounts","wsl","security","path-validation","account-id"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}