jlcodes99/cockpit-tools · error

[CodexModelProviders] 更新凭据后写入供应商失败

Error message

[CodexModelProviders] 更新凭据后写入供应商失败

What it means

Non-fatal warning in the update-credentials flow of useCodexAccountsAccessController: after updating a provider's API key, the usage probe that would persist the detected integration type (sub2api/new_api) failed; the catch logs '[CodexModelProviders] 更新凭据后写入供应商失败' and continues. The credential update itself succeeded; only the integration-type auto-detection was lost.

Source

Thrown at src/pages/useCodexAccountsAccessController.tsx:4108

                apiKey: validation.apiKey,
                integrationType: savedProvider.integrationType ?? null,
              });
              if (
                (usageSummary.mode === "sub2api" ||
                  usageSummary.mode === "new_api") &&
                usageSummary.mode !== savedProvider.integrationType
              ) {
                await saveCodexModelProviderDetectedIntegrationType(
                  savedProvider.id,
                  usageSummary.mode,
                );
              }
            } catch (usageErr) {
              console.warn("[CodexModelProviders] 额度类型探测失败", usageErr);
            }
            await reloadManagedProviders();
          } catch (providerErr) {
            console.warn(
              "[CodexModelProviders] 更新凭据后写入供应商失败",
              providerErr,
            );
          }
        }
        setMessage({
          text:
            Object.keys(parsedWindows.windows).length > 0 ||
            editingApiSyncModelCatalogToCodex
              ? `${t("instances.messages.updated", "实例已更新")} ${t(
                  "codex.api.modelCatalog.restartHint",
                  "模型目录已更新。若 Codex 正在运行,请重启后生效。",
                )}`
              : t("instances.messages.updated", "实例已更新"),
        });
        setApiKeyUsageMap((previous) => {
          const next = { ...previous };
          delete next[accountId];

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Verify the new API key works against the provider's usage endpoint
  2. Re-trigger provider detection by editing/saving the provider again
  3. Confirm integrationType in provider settings if auto-detection keeps failing
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/pages/useCodexAccountsAccessController.tsx:4108 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/0cf9e0992f752678. Report an issue: GitHub.