koala73/worldmonitor · error · Error

Authentication unavailable while loading API keys. Try again

Error message

Authentication unavailable while loading API keys. Try again.

What it means

UI service error in listApiKeys: the current user is signed in, but Convex auth had not propagated for that user before the query ran. It is a session-propagation timing failure — the server cannot yet authorize the query for this account.

Source

Thrown at src/services/api-keys.ts:92

      (api as any).apiKeys.createApiKey,
      { name: name.trim(), keyPrefix, keyHash },
    ),
  );
  assertAccountStillCurrent(userId, 'creating the API key');

  return { id: result.id, name: result.name, keyPrefix: result.keyPrefix, key: plaintext };
}

/** List all API keys for the current user. */
export async function listApiKeys(): Promise<ApiKeyInfo[]> {
  const userId = getCurrentClerkUser()?.id;
  if (!userId) return [];

  const [client, api] = await Promise.all([getConvexClient(), getConvexApi()]);
  if (!client || !api) return [];
  if (!await waitForConvexAuthForUser(userId)) {
    assertAccountStillCurrent(userId, 'loading API keys');
    throw new Error('Authentication unavailable while loading API keys. Try again.');
  }

  return settleAccountOperation(
    userId,
    'loading API keys',
    () => client.query((api as any).apiKeys.listApiKeys, {}),
  );
}

/** Revoke an API key by its Convex document ID. */
export async function revokeApiKey(keyId: string): Promise<void> {
  const userId = getCurrentClerkUser()?.id;
  if (!userId) throw new Error('Sign in to revoke API keys.');

  const [client, api] = await Promise.all([getConvexClient(), getConvexApi()]);
  if (!client || !api) throw new Error('Convex unavailable');
  if (!await waitForConvexAuthForUser(userId)) {
    throw new Error('Account changed while revoking the API key. Try again.');

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Retry — Convex auth token propagation typically completes within moments
  2. Reload the page if the error persists to force a fresh auth handshake
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/services/api-keys.ts:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/9d440bab080ec29d. Report an issue: GitHub.