jlcodes99/cockpit-tools · error

instances.quota.accountMissing

instances.quota.accountMissing

Error message

账号不存在

What it means

prepareCodexCliLaunch builds the payload for launching the Codex CLI from the open modal. When modal.target === 'account' it first verifies that modal.accountId exists in the loaded accounts list; if not, it throws a localized 'instances.quota.accountMissing' (账号不存在, 'account does not exist'). This prevents launching against a stale or deleted account.

Source

Thrown at src/pages/useCodexAccountsAccessController.tsx:1018

      setCliLaunchModal((prev) =>
        prev
          ? {
              ...prev,
              workingDir,
              workingDirError: null,
              preparing: true,
              copied: false,
              executeMessage: null,
              executeError: null,
            }
          : prev,
      );
      try {
        if (
          modal.target === "account" &&
          !accounts.some((item) => item.id === modal.accountId)
        ) {
          throw new Error(t("instances.quota.accountMissing", "账号不存在"));
        }
        const { instanceId, draft } = await buildCodexCliInstanceDraft(
          modal,
          workingDir,
        );
        const launchInfo =
          await codexInstanceService.previewCodexInstanceLaunchCommand({
            userDataDir: draft.userDataDir,
            workingDir: draft.workingDir,
            extraArgs: draft.extraArgs,
            terminal: selectedTerminal,
          });
        persistLastCodexCliWorkingDir(workingDir);
        const next: CodexCliLaunchModalState = {
          ...modal,
          instanceId,
          instanceDraft: draft,
          instanceName: draft.name,

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Close and reopen the launch modal so it binds to a currently existing account.
  2. Refresh the accounts list and re-select the target account before launching.
  3. If launching programmatically, verify accounts.some(a => a.id === accountId) before opening the modal, and fall back to target='instance' or prompt the user to pick an account.
  4. If accounts may still be loading, await the accounts query completion before calling prepareCodexCliLaunch.

Example fix

// before
openCodexCliLaunchModal({ target: 'account', accountId: staleId, ... });
// after
if (!accounts.some((item) => item.id === accountId)) {
  toast.error(t('instances.quota.accountMissing'));
  return;
}
openCodexCliLaunchModal({ target: 'account', accountId, ... });
Defensive patterns

Strategy: validation

Validate before calling

const accountExists = (accounts, accountId) =>
  modal.target !== 'account' || accounts.some((item) => item.id === accountId);
if (!accountExists(accounts, modal.accountId)) {
  toast.error(t('instances.quota.accountMissing'));
  return;
}

Type guard

const isKnownAccount = (
  accounts: { id: string }[],
  accountId?: string | null,
): accountId is string =>
  typeof accountId === 'string' && accounts.some((a) => a.id === accountId);

Try / catch

try {
  await prepareCodexCliLaunch(modal, workingDir);
} catch (e) {
  if (String(e).includes('instances.quota.accountMissing')) {
    toast.error(t('instances.quota.accountMissing'));
    closeLaunchModal();
    await refetchAccounts();
  } else throw e;
}

Prevention

When it happens

Trigger: Opening the Codex CLI launch modal with target='account' and an accountId that is not present in the accounts array — called by openCodexAccountsAccessController paths: openCodexCliLaunchModal, handleChooseCodexCliWorkingDir, or the prepared flow.

Common situations: The account was deleted (or the provider account list refreshed/filtered) while the modal was still open; a stale accountId persisted from a previous session; accounts still loading so the list is empty when the check runs.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/9990ed3751effe8c. Report an issue: GitHub.