jlcodes99/cockpit-tools · error

not_available

not_available

Error message

${skipped?.reason} || not_available

What it means

Guard in CodexSwitchProgressModal.handleUseForApiService: appendCodexLocalAccessAccounts did not include state.accountId in syncedAccountIds, so the account was skipped by the backend. The skipped record's reason becomes the thrown error message, falling back to 'not_available'; the 'use for API service' action is reported as failed.

Source

Thrown at src/components/CodexSwitchProgressModal.tsx:473

      retrySwitchAfterOAuth: true,
      retrySwitchLaunchAfterSwitch: state.launchAfterSwitch,
    });
  };

  const handleUseForApiService = async () => {
    if (!authFailure?.apiOnlyAvailable || actionBusy) return;
    setActionBusy("api");
    setActionError(null);
    try {
      const result =
        await codexLocalAccessService.appendCodexLocalAccessAccounts([
          state.accountId,
        ]);
      if (!result.syncedAccountIds.includes(state.accountId)) {
        const skipped = result.skippedAccounts.find(
          (item) => item.accountId === state.accountId,
        );
        throw new Error(skipped?.reason || "not_available");
      }
      setState(null);
      window.dispatchEvent(
        new CustomEvent("app-request-navigate", {
          detail: "codex-api-service",
        }),
      );
    } catch (error) {
      setActionError(
        t("codex.switchAuth.apiServiceAddFailed", {
          error: String(error).replace(/^Error:\s*/, ""),
        }),
      );
    } finally {
      setActionBusy(null);
    }
  };

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Inspect the skip reason returned for the account and address it (invalid tokens, duplicate, disabled)
  2. Retry the API-service action once the account passes backend validation
  3. Keep the switch modal state consistent by refreshing local access state after the failure
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/components/CodexSwitchProgressModal.tsx:473 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/ffbb8dd7fa96fc3b. Report an issue: GitHub.