diegosouzapw/OmniRoute · error · Error

Failed to load CLI keys

Error message

Failed to load CLI keys

What it means

loadCliApiKeys' fetch of the CLI tool keys endpoint returned non-OK; 'Failed to load CLI keys' is thrown (the card only tracks a boolean keysError, so the message mostly serves logs). The VS Code token alias card then renders without CLI-derived API key suggestions.

Solutions

  1. Verify session auth for the cli-tools keys endpoint
  2. Show the underlying status alongside the message
  3. Retry transient 5xx before rendering the error state
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/endpoint/VscodeTokenAliasCard.tsx:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/c7afe50a3cf4e0e1. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/endpoint/VscodeTokenAliasCard.tsx:38

}: Readonly<{ className?: string; variant?: "highlight" | "catalog" }>) {
  const t = useTranslations("endpoint");
  const [cliApiKeys, setCliApiKeys] = useState<EndpointApiKeySummary[]>([]);
  const [keysLoading, setKeysLoading] = useState(true);
  const [keysError, setKeysError] = useState(false);
  const { copied, copy } = useCopyToClipboard();
  const displayBaseUrl = useDisplayBaseUrl();

  useEffect(() => {
    let cancelled = false;

    const loadCliApiKeys = async () => {
      setKeysLoading(true);
      setKeysError(false);

      try {
        const res = await fetch("/api/cli-tools/keys");
        if (!res.ok) {
          throw new Error("Failed to load CLI keys");
        }

        const data = await res.json();
        if (!cancelled) {
          setCliApiKeys(data.keys || []);
        }
      } catch {
        if (!cancelled) {
          setCliApiKeys([]);
          setKeysError(true);
        }
      } finally {
        if (!cancelled) {
          setKeysLoading(false);
        }
      }
    };

View on GitHub (pinned to a179ffed5b)