jlcodes99/cockpit-tools · warning

加载 Codex API 服务速度失败:

Error message

加载 Codex API 服务速度失败:

What it means

console.warn in loadApiServiceAppSpeed: fetching the Codex API service speed config (codexService.getCodexApiServiceAppSpeedConfig) failed, so the speed setting stays at its previous/default value. Non-fatal — the UI logs and moves on.

Source

Thrown at src/pages/useCodexAccountsBaseController.tsx:2471

      setAccountNotePasswordVisible(true);
      setAccountNoteCopiedKey(null);
      setAccountNoteMfaPickerOpen(false);
      resetAccountNoteMailPreview();
      setAccountNoteError(null);
    }, [
      resetAccountNoteMailPreview,
      rememberActiveAccountNoteMfaQuery,
      savingAccountNote,
      savingPendingOAuthAccount,
      setAccountNoteError,
    ]);
  
    const loadApiServiceAppSpeed = useCallback(async () => {
      try {
        const config = await codexService.getCodexApiServiceAppSpeedConfig();
        setApiServiceAppSpeed(config.speed);
      } catch (error) {
        console.warn("加载 Codex API 服务速度失败:", error);
      }
    }, []);
  
    useEffect(() => {
      void loadApiServiceAppSpeed();
    }, [loadApiServiceAppSpeed]);
  
    const handleAccountAppSpeedChange = useCallback(
      async (account: CodexAccount, speed: CodexAppSpeed) => {
        if (savingAppSpeedId) return;
        setSavingAppSpeedId(account.id);
        try {
          await updateAccountAppSpeed(account.id, speed);
          setMessage({
            text: t("codex.speed.saveSuccess", "速度已更新"),
          });
        } catch (error) {
          setMessage({

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Reopen the settings/panel — the value is reloaded on mount each time.
  2. Check the Codex API service speed config file exists and parses; delete it to force regeneration of defaults if corrupt.
  3. Verify the backend command behind getCodexApiServiceAppSpeedConfig works (backend logs).
  4. Restart the app to redo startup ordering.
  5. Re-save the speed setting once to rewrite the config.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const config = await codexService.getCodexApiServiceAppSpeedConfig();
  setApiServiceAppSpeed(config.speed);
} catch (e) {
  console.warn('加载 Codex API 服务速度失败:', e);
  setApiServiceAppSpeed(DEFAULT_SPEED);
}

Prevention

When it happens

Trigger: getCodexApiServiceAppSpeedConfig() rejects — config file missing/corrupt, backend command error, or the call races app startup before config is initialized.

Common situations: First run before any speed config was persisted; config file deleted or corrupted after a crash; backend not yet ready when the effect fires on mount.

Related errors


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