jlcodes99/cockpit-tools · warning
Failed to resolve Codex API service current marker:
Error message
Failed to resolve Codex API service current marker:
What it means
A console.warn (not a throw) in useCodexAccountsBaseController when resolving whether the 'Codex API service' default instance is currently bound. The effect calls codexInstanceService.listInstances(); if that fails, the local 'current marker' UI flag is left unset and the failure is only logged.
Source
Thrown at src/pages/useCodexAccountsBaseController.tsx:1223
}
} catch {
// ignore migration failures
}
setHideRelayQuota(hide);
} catch (error) {
console.error("Failed to load codex hide-relay-quota preference:", error);
}
}, []);
const reloadLocalAccessLaunchCurrent = useCallback(async () => {
try {
const instances = await codexInstanceService.listInstances();
const defaultInstance = instances.find((instance) => instance.isDefault);
setLocalAccessLaunchCurrent(
defaultInstance?.bindAccountId === CODEX_API_SERVICE_BIND_ID,
);
} catch (error) {
console.warn(
"Failed to resolve Codex API service current marker:",
error,
);
}
}, []);
const exportFormatOptions = useMemo<SingleSelectFilterOption[]>(
() => [
{
value: "cockpit_tools",
label: t("codex.exportFormat.cockpitTools", "Cockpit Tools"),
},
{
value: "auth_json",
label: t("codex.exportFormat.authJson", "auth.json"),
},
{
value: "sub2api",View on GitHub (pinned to 1ed8b77992)
Solutions
- Retry opening the panel — the flag is recomputed on the next effect run.
- Verify the Codex instance registry (list instances manually) and confirm a default instance exists.
- Check backend/IPC logs for the listInstances failure reason.
- Restart the backend service or app so instance state is reloaded cleanly.
- Re-set the default Codex instance binding if isDefault/bindAccountId state is inconsistent.
Defensive patterns
Strategy: try-catch
Validate before calling
const instances = await codexInstanceService.listInstances().catch(() => []); if (!instances.length) return; // skip marker resolution
Try / catch
try {
const instances = await codexInstanceService.listInstances();
const def = instances.find(i => i.isDefault);
setLocalAccessLaunchCurrent(def?.bindAccountId === CODEX_API_SERVICE_BIND_ID);
} catch (e) {
console.warn('Failed to resolve Codex API service current marker:', e);
setLocalAccessLaunchCurrent(false);
} Prevention
- Gate the effect on backend-ready state so listInstances isn't called before initialization.
- Provide a sensible default for the marker (false) on failure instead of leaving stale UI state.
- Log the underlying error detail, not just the wrapper message.
When it happens
Trigger: codexInstanceService.listInstances() rejects — backend instance registry unavailable, IPC invoke error, corrupted/missing instance config, or the effect runs while the backend has not finished initializing.
Common situations: App startup race where the instances backend isn't ready; user opened the local access/API-service panel before login/backend startup completed; instance list file corrupted after an abnormal shutdown.
Related errors
- [Codex Batch Delete] 查询任务进度失败:
- 加载 Codex API 服务速度失败:
- [Codex Store] 自动恢复接管失败:
- messages.rawLineNoRefreshToken(item.lineNumber)
- messages.rawLineMultipleRefreshTokens(item.lineNumber)
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/14c0c412148e07ed.
Report an issue: GitHub.