Nishil Faldu
Nishil Faldu2mo ago

Pause Notifications Error

7/7/2025, 2:13:40 PM [CONVEX M(socialMedia/pushNotifications:pausePushNotifications)] Uncaught Error: ArgumentValidationError: Found ID "j571cwsxpn17r8d4p7pkvdjdyh7gw31s" from table `notifications`, which does not match the table name in validator `v.id("users")`.Path: .userId

at async handler (../../convex/socialMedia/pushNotifications.ts:60:21)
7/7/2025, 2:13:40 PM [CONVEX M(socialMedia/pushNotifications:pausePushNotifications)] Uncaught Error: ArgumentValidationError: Found ID "j571cwsxpn17r8d4p7pkvdjdyh7gw31s" from table `notifications`, which does not match the table name in validator `v.id("users")`.Path: .userId

at async handler (../../convex/socialMedia/pushNotifications.ts:60:21)
I don't know what's wrong here as I am passing a field of type Id<'users'> here. Below is my code:
export const pausePushNotifications = mutation({
args: {
actionType: v.union(v.literal('pause'), v.literal('unpause')),
userId: v.id('users'),
},
handler: async (ctx, args) => {
if (args.actionType === 'pause') {
await pushNotifications.pauseNotificationsForUser(ctx, {
userId: args.userId,
});
} else {
await pushNotifications.unpauseNotificationsForUser(ctx, {
userId: args.userId,
});
}
},
});
export const pausePushNotifications = mutation({
args: {
actionType: v.union(v.literal('pause'), v.literal('unpause')),
userId: v.id('users'),
},
handler: async (ctx, args) => {
if (args.actionType === 'pause') {
await pushNotifications.pauseNotificationsForUser(ctx, {
userId: args.userId,
});
} else {
await pushNotifications.unpauseNotificationsForUser(ctx, {
userId: args.userId,
});
}
},
});
8 Replies
Convex Bot
Convex Bot2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
ian
ian2mo ago
I'd look at the dashboard to see what the ID j571cwsxpn17r8d4p7pkvdjdyh7gw31s corresponds to - I suspect it's in the notifications table, based on the error message
Nishil Faldu
Nishil FalduOP2mo ago
its a userId and I don't know how it can be in the notifications table when it does even have a userId column (also I checked in the dashboard too) I just emptied the notifications table, it still gives me the same error
ian
ian2mo ago
I'd find whatever is trying to pass j571cwsxpn17r8d4p7pkvdjdyh7gw31s to socialMedia/pushNotifications:pausePushNotifications - the argument validation doesn't try to look up the ID - only checks that it's a valid ID for that table (has the right table metadata encoded in it)
Nishil Faldu
Nishil FalduOP3w ago
I still can't seem to find out what the problem is 🤷‍♂️
erquhart
erquhart3w ago
If you can share more code so we can see where you're getting the id that you're passing that would help I've also seen folks compare an id from an error message like this to an id in their database visually and say they match, but on closer inspection they look very similar but aren't actually the same.
ian
ian3w ago
Try on the latest version - I put up a fix
Nishil Faldu
Nishil FalduOP3w ago
It works now, thank you so much for the fix!

Did you find this page helpful?