jlcodes99/cockpit-tools · error

[CodexModelProviders] 添加账号前写入供应商失败

Error message

[CodexModelProviders] 添加账号前写入供应商失败

What it means

Non-fatal warning in the add-account flow: writing the model provider record (saveCodexModelProvider / detected integration type) failed before the account could reference it; the failure is logged as '[CodexModelProviders] 添加账号前写入供应商失败' and swallowed so the surrounding account-add flow can decide how to proceed. It indicates the provider row was not persisted, so usage detection was skipped.

Source

Thrown at src/pages/useCodexAccountsAccessController.tsx:2512

                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,
            );
            throw providerErr;
          }
        }
        const account = await codexService.addCodexAccountWithApiKey(
          validation.apiKey,
          validation.apiBaseUrl,
          finalProviderPayload.apiProviderMode,
          finalProviderPayload.apiProviderId,
          finalProviderPayload.apiProviderName,
          finalProviderPayload.apiModelCatalog,
          finalProviderPayload.apiSupportsVision,
          finalProviderPayload.apiModelVisionSupport,
          finalProviderPayload.apiVisionRoutingModel,
          finalProviderPayload.accountName,
          finalProviderPayload.apiWireApi,

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Check storage/IPC errors behind saveCodexModelProvider before retrying the add-account flow
  2. Retry saving the provider manually from the provider settings UI
  3. Treat the account as bound to a stale provider config until the provider row persists
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/pages/useCodexAccountsAccessController.tsx:2512 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/217fcf097a38062d. Report an issue: GitHub.