{"record":{"id":"5832250e28c71891","repo":"koala73/worldmonitor","slug":"not-owner","errorCode":"NOT_OWNER","errorMessage":"NOT_OWNER","messagePattern":"NOT_OWNER","errorType":"error_code","errorClass":"ConvexError","httpStatus":null,"severity":"error","filePath":"convex/payments/businessSeats.ts","lineNumber":420,"sourceCode":"      })),\n    };\n  },\n});\n\n/**\n * Owner-only removal of a single seat. Revokes the grant and recomputes the\n * invitee's entitlement.\n */\nexport const removeSeat = mutation({\n  args: { grantId: v.id(\"businessProGrants\") },\n  handler: async (ctx, args) => {\n    const userId = await requireUserId(ctx);\n    const grant = await ctx.db.get(args.grantId);\n    if (!grant) {\n      throw new ConvexError({ kind: \"GRANT_NOT_FOUND\" });\n    }\n    if (grant.ownerUserId !== userId) {\n      throw new ConvexError({ kind: \"NOT_OWNER\" });\n    }\n    if (grant.status !== \"pending\" && grant.status !== \"accepted\") {\n      return { ok: true as const, status: \"already_inactive\" as const };\n    }\n\n    const now = Date.now();\n    // Serialize with inviteSeats via the per-Business-subscription lock row.\n    await touchBusinessSeatLock(ctx, grant.businessSubscriptionId, now);\n\n    await ctx.db.patch(args.grantId, { status: \"revoked\" });\n\n    if (grant.inviteeUserId) {\n      await ctx.runMutation(\n        internal.payments.subscriptionHelpers.recomputeEntitlementForUser,\n        { userId: grant.inviteeUserId, eventTimestamp: now },\n      );\n    }\n    return { ok: true as const, status: \"revoked\" as const };","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/convex/payments/businessSeats.ts#L402-L438","documentation":"Structured ConvexError thrown by removeSeat when the grant exists but its ownerUserId does not match the signed-in user. Seat removal is owner-only; a non-owner attempting to revoke someone else's seat is refused even if the grant id is valid.","triggerScenarios":"Thrown at convex/payments/businessSeats.ts:424 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only the original inviter may remove a seat; sign in as that account","If ownership legitimately changed, have support transfer the Business subscription first"],"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"}