koala73/worldmonitor · error · ConvexError
INVALID_USER_ID
INVALID_USER_ID
Error message
INVALID_USER_ID
What it means
Validation in the issueProMcpToken internal mutation: the supplied userId is not a valid user identifier (empty or malformed). The edge caller at /oauth/authorize-pro passes the verified Clerk userId after the cross-subdomain grant check; an invalid one means the grant validation upstream produced garbage.
Source
Thrown at convex/mcpProTokens.ts:48
*
* Called from the edge at `/oauth/authorize-pro` after the cross-subdomain
* Clerk grant has been validated. The caller passes the verified Clerk
* `userId`. Verifies active Pro MCP entitlement defensively; the edge checks
* too, but this mutation is the authoritative row-insertion gate.
*
* Per-user 5-row cap with silent oldest rotation: if the user already has
* 5 active rows we revoke the oldest (by createdAt) before inserting the
* new one — never delete (preserves audit trail).
*/
export const issueProMcpToken = internalMutation({
args: {
userId: v.string(),
clientId: v.optional(v.string()),
name: v.optional(v.string()),
},
handler: async (ctx, args) => {
if (!args.userId) {
throw new ConvexError("INVALID_USER_ID");
}
const entitlement = await ctx.db
.query("entitlements")
.withIndex("by_userId", (q) => q.eq("userId", args.userId))
.first();
const mergedFeatures = entitlement
? mergeEntitlementFeatures(entitlement.planKey, entitlement.features)
: null;
const isPro = Boolean(
entitlement
&& mergedFeatures
&& entitlement.validUntil >= Date.now()
&& mergedFeatures.tier >= 1
&& mergedFeatures.mcpAccess === true,
);
// #6716 — a CONFIRMED free account may also hold a token.
//View on GitHub (pinned to eeab0a219f)
Solutions
- Verify the Clerk grant validation at /oauth/authorize-pro extracts and passes the real userId
- Reject the authorize request upstream if the verified subject is empty
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at convex/mcpProTokens.ts:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/3d74c4b21cd7a8ae.
Report an issue: GitHub.