#Error codegen
3 messages · Page 1 of 1 (latest)
The error message you're seeing:
Uncaught TypeError: Cannot read properties of undefined (reading 'isConvexValidator')
indicates that somewhere in your schema (specifically in cron/job.js or the referenced line in schema.ts), a validator is expected, but an undefined value is being passed instead. This is a common issue when:
- You accidentally use a plain value instead of a Convex validator (e.g.,
v.object({ field: "foo" })instead ofv.object({ field: v.literal("foo") })). - You have a typo or missing import, so a validator is actually undefined.
- There is a circular dependency between files, causing an imported validator to be undefined at runtime.
- You are using an invalid validator in your schema, args, or returns.
How to debug:
-
Check your schema definition: Make sure every field in your
defineTableand every argument/return validator is a valid Convex validator, not a plain value or undefined. -
Check for typos and missing imports: Ensure all validators are correctly imported and spelled.
-
Check for circular dependencies: If you have validators importing each other across files, this can cause one to be undefined at runtime. Try moving shared validators to a separate file to avoid cycles.
-
Check for invalid usage: For example, don't do this:
v.object({ field: "foo" }) // WRONGInstead, do:
v.object({ field: v.literal("foo") }) // CORRECT -
Check for multiple Convex versions: If you have multiple versions of Convex installed (e.g., via dependencies like
convex-helpers), this can cause issues. Make sure all Convex-related packages are up to date and consistent.
Relevant references:
- "it sounds like you have an invalid validator (
v.array,v.number, etc), either in args or returns or your schema." - "the common cases are a weird validator in your schema (I've seen stuff like
v.object({ field: "foo" })instead ofv.object({ field: v.literal("foo") })as an example) or sometimes this happens if there are multiple versions of Convex floating around..." - "I just experienced this same error when I had a circular dependency in some validators."
See discussion
If you share the contents of cron/job.ts, I can help pinpoint the exact issue. But based on the error and the line in schema.ts, look for any of the above issues in the table definition or validator usage around line 161 of your schema.