{"record":{"id":"73d7624fd04ef4d2","repo":"koala73/worldmonitor","slug":"invitee-email-unavailable","errorCode":"INVITEE_EMAIL_UNAVAILABLE","errorMessage":"INVITEE_EMAIL_UNAVAILABLE","messagePattern":"INVITEE_EMAIL_UNAVAILABLE","errorType":"error_code","errorClass":"ConvexError","httpStatus":null,"severity":"error","filePath":"convex/payments/businessSeats.ts","lineNumber":456,"sourceCode":"    return { ok: true as const, status: \"revoked\" as const };\n  },\n});\n\n/**\n * Invitee redeems an HMAC token to accept a Business Pro seat invite. Verifies\n * the token, matches the signed-in Clerk email against the invited address,\n * checks the underlying Business subscription is still covering, flips the\n * grant to `accepted`, stamps `inviteeUserId`, and recomputes the invitee's\n * entitlement. Single-use: accepted/revoked/expired tokens are rejected.\n */\nexport const acceptBusinessInvite = mutation({\n  args: { grantId: v.id(\"businessProGrants\"), token: v.string() },\n  handler: async (ctx, args) => {\n    const userId = await requireUserId(ctx);\n    const identity = await resolveUserIdentity(ctx);\n    const inviteeEmail = identity?.email?.trim().toLowerCase();\n    if (!inviteeEmail) {\n      throw new ConvexError({ kind: \"INVITEE_EMAIL_UNAVAILABLE\" });\n    }\n\n    const grant = await ctx.db.get(args.grantId);\n    if (!grant) {\n      throw new ConvexError({ kind: \"GRANT_NOT_FOUND\" });\n    }\n    if (grant.status !== \"pending\") {\n      throw new ConvexError({ kind: \"INVITE_ALREADY_USED\" });\n    }\n    const now = Date.now();\n    if (grant.expiresAt <= now) {\n      throw new ConvexError({ kind: \"INVITE_EXPIRED\" });\n    }\n    if (!(await verifyBusinessInviteToken(args.grantId, args.token))) {\n      throw new ConvexError({ kind: \"INVALID_INVITE_TOKEN\" });\n    }\n    if (grant.inviteeEmail !== inviteeEmail) {\n      throw new ConvexError({ kind: \"INVITE_EMAIL_MISMATCH\" });","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/convex/payments/businessSeats.ts#L438-L474","documentation":"Structured ConvexError thrown by acceptBusinessInvite when the accepting user's Clerk identity exposes no email address. Invite redemption matches the signed-in email against the invited address, so a user without a resolvable email cannot be matched to a grant.","triggerScenarios":"Thrown at convex/payments/businessSeats.ts:460 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the invitee's Clerk profile has a primary email set","Re-authenticate so a fresh identity token with email claims is available","Sign in with the account whose address was invited"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d06c8633d256c18e38133030bc3613976a96ec9","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}