koala73/worldmonitor · error · Error

Account changed while revoking the API key. Try again.

Error message

Account changed while revoking the API key. Try again.

What it means

UI service error in revokeApiKey (via assertAccountStillCurrent): the authenticated user changed between starting and completing the revocation, so the operation is aborted rather than revoking a key under the wrong account.

Source

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

    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.');
  }

  const result = await settleAccountOperation(
    userId,
    'revoking the API key',
    () => client.mutation((api as any).apiKeys.revokeApiKey, { keyId }),
  );
  assertAccountStillCurrent(userId, 'revoking the API key');

  // Await cache bust so the gateway stops accepting the revoked key immediately.
  // If this fails, the 60s cache TTL limits the staleness window.
  if (result?.keyHash) {
    const token = await settleAccountOperation(
      userId,
      'invalidating the API key cache',
      getClerkToken,
    );
    if (token) {

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Retry revocation after the account state settles
  2. Do not switch accounts while a revocation is in flight
Defensive patterns

Strategy: retry

When it happens

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

Common situations: See trigger scenarios.


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