Value does not match validator
I pass a convex id as an URL params. This URL params i use to make a query to get other list of data. What i wanted to do was if someone tried to modify the URL say it doesnt exist but i get the convex error. Any solution as to why this happens ?

7 Replies
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!
You can use validator v.string() and check yourself in the function with ctx.db.normalizeId and/or ctx.db.get
i dont quite understand
i know i am sending invalid id, what i want is to make a query and then reutrn error message that it doesnt work. Currently it crashes when i query with invalid query instead of giving me doesnt exist error
yes i think i understand. instead of
subjectId: v.id("subjects")
do subjectId: v.string()
. Then in your function do const subject = await ctx.db.get(args.subjectId);
and then if (subject === null) throw new ConvexError("invalid subject")
im having hard time fixing this issue
Are you still seeing this error?
What does your args validator look like?
@uzamaki21 - you can cast your URL parameter as required. This is how I do the same thing (using tanstack router & tanstack query in this example):