jlcodes99/cockpit-tools · warning

Failed to resolve Codex API service current marker:

Error message

Failed to resolve Codex API service current marker:

What it means

A console.warn (not a throw) in useCodexAccountsBaseController when resolving whether the 'Codex API service' default instance is currently bound. The effect calls codexInstanceService.listInstances(); if that fails, the local 'current marker' UI flag is left unset and the failure is only logged.

Source

Thrown at src/pages/useCodexAccountsBaseController.tsx:1223

          }
        } catch {
          // ignore migration failures
        }
        setHideRelayQuota(hide);
      } catch (error) {
        console.error("Failed to load codex hide-relay-quota preference:", error);
      }
    }, []);
  
    const reloadLocalAccessLaunchCurrent = useCallback(async () => {
      try {
        const instances = await codexInstanceService.listInstances();
        const defaultInstance = instances.find((instance) => instance.isDefault);
        setLocalAccessLaunchCurrent(
          defaultInstance?.bindAccountId === CODEX_API_SERVICE_BIND_ID,
        );
      } catch (error) {
        console.warn(
          "Failed to resolve Codex API service current marker:",
          error,
        );
      }
    }, []);
  
    const exportFormatOptions = useMemo<SingleSelectFilterOption[]>(
      () => [
        {
          value: "cockpit_tools",
          label: t("codex.exportFormat.cockpitTools", "Cockpit Tools"),
        },
        {
          value: "auth_json",
          label: t("codex.exportFormat.authJson", "auth.json"),
        },
        {
          value: "sub2api",

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Retry opening the panel — the flag is recomputed on the next effect run.
  2. Verify the Codex instance registry (list instances manually) and confirm a default instance exists.
  3. Check backend/IPC logs for the listInstances failure reason.
  4. Restart the backend service or app so instance state is reloaded cleanly.
  5. Re-set the default Codex instance binding if isDefault/bindAccountId state is inconsistent.
Defensive patterns

Strategy: try-catch

Validate before calling

const instances = await codexInstanceService.listInstances().catch(() => []);
if (!instances.length) return; // skip marker resolution

Try / catch

try {
  const instances = await codexInstanceService.listInstances();
  const def = instances.find(i => i.isDefault);
  setLocalAccessLaunchCurrent(def?.bindAccountId === CODEX_API_SERVICE_BIND_ID);
} catch (e) {
  console.warn('Failed to resolve Codex API service current marker:', e);
  setLocalAccessLaunchCurrent(false);
}

Prevention

When it happens

Trigger: codexInstanceService.listInstances() rejects — backend instance registry unavailable, IPC invoke error, corrupted/missing instance config, or the effect runs while the backend has not finished initializing.

Common situations: App startup race where the instances backend isn't ready; user opened the local access/API-service panel before login/backend startup completed; instance list file corrupted after an abnormal shutdown.

Related errors


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