{"record":{"id":"1a17d4269514aa6c","repo":"stablyai/orca","slug":"managed-codex-home-directory-does-not-exist-on-dis-1a17d4","errorCode":null,"errorMessage":"Managed Codex home directory does not exist on disk.","messagePattern":"Managed Codex home directory does not exist on disk\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/codex-accounts/service.ts","lineNumber":1506,"sourceCode":"                  'managed_root_real=$(readlink -f -- \"$managed_root\")',\n                  'test -f \"$candidate_real/.orca-managed-home\"',\n                  ...(expectedAccountId === undefined\n                    ? [\n                        'case \"$candidate_real\" in \"$managed_root_real\"/*/home) printf \"%s\\\\n\" \"$candidate_real\" ;; *) exit 35 ;; esac'\n                      ]\n                    : [\n                        `expected_marker=${shellQuote(expectedAccountId)}`,\n                        'test \"$candidate_real\" = \"$managed_root_real/$expected_marker/home\"',\n                        'test \"$(cat \"$candidate_real/.orca-managed-home\")\" = \"$expected_marker\"',\n                        'printf \"%s\\\\n\" \"$candidate_real\"'\n                      ])\n                ].join('\\n')\n              )\n            ],\n            { encoding: 'utf-8', timeout: 5000 }\n          ).trim()\n          if (!canonicalLinuxPath) {\n            throw new Error('Managed Codex home directory does not exist on disk.')\n          }\n          return toWindowsWslPath(canonicalLinuxPath, wslInfo.distro)\n        } catch (error) {\n          throw new Error('Managed WSL Codex home is outside Orca account storage.', {\n            cause: error\n          })\n        }\n      }\n\n      if (wslInfo.linuxPath.split('/').includes('..')) {\n        throw new Error('Managed WSL Codex home is outside Orca account storage.')\n      }\n      if (!existsSync(candidatePath)) {\n        throw new Error('Managed Codex home directory does not exist on disk.')\n      }\n      if (!existsSync(join(candidatePath, '.orca-managed-home'))) {\n        throw new Error('Managed Codex home is missing Orca ownership marker.')\n      }","sourceCodeStart":1488,"sourceCodeEnd":1524,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/codex-accounts/service.ts#L1488-L1524","documentation":"Thrown by assertManagedHomePath in two cases: (1) WSL branch — the wsl.exe canonicalization returned an empty string, meaning the path does not resolve to a real directory inside the distro (service.ts:1506); (2) the non-Windows-UNC fallback — existsSync(candidatePath) is false (service.ts:1520). Orca will not operate on a managed home that is not actually present on disk.","triggerScenarios":"Re-authenticating or importing into a managed home whose directory was deleted from disk (host branch), or whose WSL path does not exist inside the distro (WSL branch returns empty canonical path).","commonSituations":"User or a cleanup tool deleted <userData>/codex-accounts/<id>/home; the WSL distro was unregistered/reset (so the linux path is gone); or the account was restored from a backup that did not include the home directories.","solutions":["For host accounts on re-auth, ensureManagedHomeForReauthentication (service.ts:1370) recreates the home at the exact persisted path — ensure that path matches and re-run reauthenticateAccount.","For WSL, confirm the distro is registered and the linux path exists; if the distro was reset, re-add the account.","If the home cannot be recovered, remove the account and add it again so a fresh managed home is created."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the managed home exists on disk before re-auth/import.\nimport { existsSync } from 'node:fs'\nif (!existsSync(account.managedHomePath)) {\n  // for host re-auth, ensureManagedHomeForReauthentication will recreate it at the persisted path;\n  // for other flows, remove + re-add the account\n}","typeGuard":null,"tryCatchPattern":"try {\n  await service.reauthenticateAccount(accountId)\n} catch (error) {\n  if (error instanceof Error && error.message === 'Managed Codex home directory does not exist on disk.') {\n    // remove and re-add the account to recreate its managed home\n  } else throw error\n}","preventionTips":["Do not delete <userData>/codex-accounts or the WSL managed-home trees.","Back up managed homes alongside settings when migrating installations."],"tags":["codex-accounts","filesystem","missing-directory","wsl","reauthenticate"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}