koala73/worldmonitor · error · Error
Account changed while ${action}. Try again.
Error message
Account changed while ${action}. Try again. What it means
Error thrown by requireCurrentConvexUser when the signed-in Clerk user id no longer matches the current Convex user record — the authenticated identity changed mid-session (account switch or re-auth) while a billing action was in flight. Retrying after re-sync resolves it.
Source
Thrown at src/services/billing.ts:93
// 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).
*/
export async function initSubscriptionWatch(
_userId?: string,
isCurrent: () => boolean = () => true,
): Promise<void> {
const isExpectedAccount = (): boolean => (
isCurrent() && (_userId === undefined || getCurrentClerkUser()?.id === _userId)
);
if (initialized || !isExpectedAccount()) return;
View on GitHub (pinned to 9361220cc0)
Solutions
- Retry the action after the new session settles
- Ensure Clerk/Convex identity sync completes after account switches
- Avoid switching accounts while a billing dialog is open
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/services/billing.ts:81 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/f8a243a0016a4b15.
Report an issue: GitHub.