jlcodes99/cockpit-tools · warning

[Codex Auto-Restore] 恢复代理接管失败:

Error message

[Codex Auto-Restore] 恢复代理接管失败:

What it means

restoreCodexActiveTakeoverIfEnabled wraps invoke('restore_codex_active_takeover_if_enabled') in try/catch and logs '[Codex Auto-Restore] 恢复代理接管失败' on failure, returning false. It attempts to re-apply the last saved proxy-takeover state at startup; failure means proxy takeover is simply not restored this session.

Source

Thrown at src/services/codexService.ts:726

export interface CodexMailPreviewFetchResult {
  status: number;
  contentType?: string | null;
  body: string;
  truncated: boolean;
}

export async function fetchCodexAccountNoteMailUrl(
  mailUrl: string,
): Promise<CodexMailPreviewFetchResult> {
  return await invoke('fetch_codex_account_note_mail_url', { mailUrl });
}

export async function restoreCodexActiveTakeoverIfEnabled(): Promise<boolean> {
  try {
    return await invoke<boolean>('restore_codex_active_takeover_if_enabled');
  } catch (e) {
    console.warn('[Codex Auto-Restore] 恢复代理接管失败:', e);
    return false;
  }
}

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Manually enable Codex proxy takeover in the app settings — restore is an automatic convenience only.
  2. Check for conflicting proxy managers and close them, then retry restore.
  3. Inspect/clear the saved takeover state file if it points to a stale proxy port.
  4. Run the app with sufficient privileges (some OSes restrict proxy changes) and confirm network settings are writable.
  5. Check backend logs for the underlying invoke error.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await invoke<boolean>('restore_codex_active_takeover_if_enabled');
} catch (e) {
  console.warn('[Codex Auto-Restore] 恢复代理接管失败:', e);
  return false;
}

Prevention

When it happens

Trigger: The Tauri command restore_codex_active_takeover_if_enabled rejects: proxy settings cannot be applied by the OS, saved takeover state is corrupt, required privileges are missing, or the proxy backend is unavailable at startup.

Common situations: System proxy is managed by another tool (clash/v2ray) blocking the change; app launched without network permissions; leftover state file referencing a stale port/process; corporate policy preventing proxy modification.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/1479d83f80a92b7a. Report an issue: GitHub.