{"record":{"id":"f6e4a1c46135854c","repo":"stablyai/orca","slug":"the-codex-account-credentials-for-this-session-are","errorCode":null,"errorMessage":"The Codex account credentials for this session are temporarily unavailable. Try opening the terminal again.","messagePattern":"The Codex account credentials for this session are temporarily unavailable\\. Try opening the terminal again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/ipc/pty.ts","lineNumber":1315,"sourceCode":"\ntype ManagedCodexAuthResolutionArgs = {\n  selectedCodexHomePath: string | null\n  getSettings: () => GlobalSettings | undefined\n  requiredCodexHomePath?: string\n  target: CodexAccountSelectionTarget\n  resolveCurrent: () => string | null\n  resolveAfterUnavailable: (unavailableManagedHomePath: string) => string | null\n}\n\nexport function resolveCodexHomeAfterManagedAuthReadiness(\n  args: ManagedCodexAuthResolutionArgs\n): string | null | Promise<string | null> {\n  const selectedCodexHomePath = args.selectedCodexHomePath\n  if (\n    args.requiredCodexHomePath &&\n    !codexHomePathsEqual(selectedCodexHomePath, args.requiredCodexHomePath)\n  ) {\n    throw new Error(CODEX_RESUME_AUTH_UNAVAILABLE_MESSAGE)\n  }\n  const readiness = waitForManagedCodexAuthReady({\n    codexHomePath: selectedCodexHomePath,\n    settings: args.getSettings(),\n    target: args.target\n  })\n  return readiness\n    ? continueCodexHomeAfterManagedAuthWait(args, selectedCodexHomePath, readiness)\n    : selectedCodexHomePath\n}\n\nasync function continueCodexHomeAfterManagedAuthWait(\n  args: ManagedCodexAuthResolutionArgs,\n  initialCodexHomePath: string | null,\n  initialReadiness: Promise<boolean>\n): Promise<string | null> {\n  let selectedCodexHomePath = initialCodexHomePath\n  let readiness = initialReadiness","sourceCodeStart":1297,"sourceCodeEnd":1333,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/pty.ts#L1297-L1333","documentation":"Thrown by resolveCodexHomeAfterManagedAuthReadiness when a session-scoped requiredCodexHomePath is supplied but the currently selectedCodexHomePath does not match it (compared via codexHomePathsEqual, which normalizes path separators). The 'session' phrasing indicates the resume is bound to specific credentials that the active selection cannot honor — so resuming would silently start under a different account.","triggerScenarios":"Resuming a persisted Codex session whose auth.json lives under home A, while the user has since switched the active managed Codex account to home B. Concretely: args.requiredCodexHomePath is set AND !codexHomePathsEqual(selectedCodexHomePath, requiredCodexHomePath).","commonSituations":"Account switch between the session being saved and reopened; managed-home path changed by settings sync; WSL/host home directory moved; multi-account setups where the dropdown selection drifts from the persisted session.","solutions":["Open the terminal again and pick the managed Codex account whose home matches the session's requiredCodexHomePath.","If the original account is gone, start a fresh Codex session instead of resuming — the resume is intentionally rejected to avoid running under the wrong identity.","Check Settings > Codex managed accounts to confirm the expected managedHomePath still exists and is selected.","Verify path normalization isn't causing a false mismatch (trailing slash, Windows vs POSIX separators on WSL)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { normalizeRuntimePathForComparison } from '../../shared/cross-platform-path'\n\nfunction codexHomeMatchesRequired(selected: string | null, required: string | undefined): boolean {\n  if (!required) return true\n  return normalizeRuntimePathForComparison(selected) === normalizeRuntimePathForComparison(required)\n}\n\n// before resume\nif (!codexHomeMatchesRequired(currentSelection, session.requiredCodexHomePath)) {\n  promptUserToSelectAccountForSession(session.id)\n}","typeGuard":"function isCodexAuthUnavailableMessage(err: unknown): boolean {\n  return err instanceof Error && err.message.startsWith('The Codex account credentials for this session')\n}","tryCatchPattern":"try {\n  await resolveCodexHomeAfterManagedAuthReadiness(args)\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('The Codex account credentials for this session')) {\n    // transient; surface 'try again' UI, do not flag as a hard failure\n    return { kind: 'retry' }\n  }\n  throw err\n}","preventionTips":["Do not switch the managed Codex account selection while a session resume is in flight.","Persist the session's requiredCodexHomePath and pre-validate the current selection against it before invoking resume.","Use normalizeRuntimePathForComparison for any path equality check to avoid trailing-slash/separator false mismatches."],"tags":["codex","auth","managed-account","resume","session-identity"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}