koala73/worldmonitor · error · Error

Sign in to ${action}.

Error message

Sign in to ${action}.

What it means

Error thrown by requireSignedInUserId in the browser billing service when no current Clerk user id is available — the visitor is not signed in. It is a generic auth precondition guard: any billing action named by the interpolated verb (open portal, invite seats, claim activation, …) requires an authenticated session first.

Source

Thrown at src/services/billing.ts:84

  // without it the same fault produces two differently-shaped titles depending
  // on which branch caught it, and neither says where it happened.
  if (typeof DOMException !== 'undefined' && err instanceof DOMException) {
    const wrapped = new Error(`[billing] ${action}: ${err.name}: ${err.message}`);
    (wrapped as Error & { cause?: unknown }).cause = err;
    return wrapped;
  }
  const rendered = err === undefined ? 'undefined' : String(err);
  const wrapped = new Error(`[billing] ${action} threw non-Error: ${rendered}`);
  // Attach the original thrown value as `cause` so Sentry shows it as structured data.
  // Assigned post-construction because tsconfig target=ES2020 lacks ErrorOptions typing;
  // Sentry and modern browsers read the property either way.
  (wrapped as Error & { cause?: unknown }).cause = err;
  return wrapped;
}

function requireSignedInUserId(action: string): string {
  const userId = getCurrentClerkUser()?.id;
  if (!userId) throw new Error(`Sign in to ${action}.`);
  return userId;
}

async function requireCurrentConvexUser(
  userId: string,
  action: string,
): Promise<void> {
  if (!await waitForConvexAuthForUser(userId)) {
    throw new Error(`Account changed while ${action}. Try again.`);
  }
  assertAccountStillCurrent(userId, action);
}

/**
 * Initialize the subscription watch for the authenticated user.
 * Idempotent -- calling multiple times is a no-op after the first.
 * Failures are logged but never thrown (dashboard must not break).
 */

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Prompt the user to sign in via Clerk before retrying the billing action
  2. Ensure the Clerk auth state is fully loaded before invoking billing service functions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/services/billing.ts:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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