jlcodes99/cockpit-tools · error
codex.api.oauthBinding.saveFailed
codex.api.oauthBinding.saveFailed
Error message
codex.api.oauthBinding.saveFailed (OAuth 绑定失败:绑定目标账号缺失)
What it means
Thrown by the Codex OAuth binding completion path: after a successful re-authorization the code tries to persist the OAuth binding, but the target account (account?.id or the binding target) is missing, so there is no account to bind the fresh credentials to. The message is the i18n key codex.api.oauthBinding.saveFailed with the 'missing binding target account' variant.
Source
Thrown at src/pages/useCodexAccountsOAuthController.ts:1198
// 避免卡片继续展示重新授权前的运行态快照。
void reloadLocalAccessState();
// 绑定流程发起的重新授权需要在新凭据落盘后自动恢复原操作,
// 保证 API Service 与 API Key 绑定 OAuth 使用同一套授权状态机。
if (reauthRetryOAuthBinding && account?.id) {
try {
if (reauthRetryOAuthBinding.targetKind === "local_access") {
await codexLocalAccessService.updateCodexLocalAccessBoundOAuthAccount(
account.id,
reauthRetryOAuthBinding.quotaReserve ?? null,
);
await reloadLocalAccessState();
} else if (reauthRetryOAuthBinding.targetAccountId) {
await updateApiKeyBoundOAuthAccount(
reauthRetryOAuthBinding.targetAccountId,
account.id,
);
} else {
throw new Error(
t("codex.api.oauthBinding.saveFailed", {
defaultValue: "OAuth 绑定失败:绑定目标账号缺失",
error: t(
"codex.api.oauthBinding.validationRequired",
"请选择 OAuth 账号",
),
}),
);
}
} catch (error) {
setAddStatus("error");
setAddMessage(
t("codex.api.oauthBinding.saveFailed", {
defaultValue: "OAuth 绑定失败:{{error}}",
error: String(error).replace(/^Error:\s*/, ""),
}),
);
return;View on GitHub (pinned to 1ed8b77992)
Solutions
- Reload the account list before retrying the binding so the target account id is available
- Check why the account was removed mid-flow (concurrent delete or store not refreshed) and retry after it exists
- If the account was deleted intentionally, cancel the pending binding instead of retrying
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/pages/useCodexAccountsOAuthController.ts:1198 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/0c23d11cfc102be8.
Report an issue: GitHub.