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
- Reopen the settings/panel — the value is reloaded on mount each time.
- Check the Codex API service speed config file exists and parses; delete it to force regeneration of defaults if corrupt.
- Verify the backend command behind getCodexApiServiceAppSpeedConfig works (backend logs).
- Restart the app to redo startup ordering.
- 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
- Fall back to a documented default speed on load failure.
- Validate/repair the config file at backend startup so reads don't fail.
- Gate the load on backend readiness to avoid startup races.
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
- [Codex Store] 自动恢复接管失败:
- Failed to apply startup page preference:
- [ExternalImport] 读取待处理导入请求失败:
- [Codex Batch Delete] 查询任务进度失败:
- Failed to resolve Codex API service current marker:
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/85077ba19c92b265.
Report an issue: GitHub.