koala73/worldmonitor · error · ConvexError

AUTH_REQUIRED

AUTH_REQUIRED

Error message

AUTH_REQUIRED

What it means

Auth gate from requireUserId in convex/lib/auth.ts: resolveUserId found no authenticated identity. Thrown deliberately as a ConvexError so Convex's server-side Sentry treats it as an expected business error (WebSocket/auth races on query fire) rather than reporting every unauthenticated call.

Solutions

  1. Ensure the client establishes an auth session before invoking the mutation or query
  2. For fire-on-load queries, expect this error during sign-out races and handle it silently client-side
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at convex/lib/auth.ts:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-09-22). Data as JSON: /api/errors/8fc3f6a768fd0151. Report an issue: GitHub.

Appendix: source

Thrown at convex/lib/auth.ts:65

  const plan = identity.plan === 'free' || identity.plan === 'pro' ? identity.plan : undefined;
  return { ...identity, plan };
}

/**
 * Returns the current user's ID or throws if unauthenticated.
 * Use for mutations/actions that always require auth.
 */
export async function requireUserId(
  ctx: QueryCtx | MutationCtx | ActionCtx,
): Promise<string> {
  const userId = await resolveUserId(ctx);
  if (!userId) {
    // ConvexError so clients can narrow AUTH_REQUIRED via the ConvexError
    // contract (error.data). It is NOT exempt from Convex→Sentry reporting —
    // expected denials still appear as Uncaught ConvexError (e.g. WORLDMONITOR-XM).
    // High-frequency expected denials need a return value, not a throw, to stay
    // out of exception ingest; do not suppress these codes by message at Sentry.
    throw new ConvexError("AUTH_REQUIRED");
  }
  return userId;
}

View on GitHub (pinned to e586b8b4b8)