#how to fix

1 messages · Page 1 of 1 (latest)

lean cairn
#

how to fix this:

8/23/2025, 11:36:32 PM [CONVEX M(auth:store)] Uncaught Error: Index users.email not found.
at uniqueUserWithVerifiedEmail (../../node_modules/@convex-dev/auth/src/server/implementation/users.ts:171:41)
at defaultCreateOrUpdateUser (../../node_modules/@convex-dev/auth/src/server/implementation/users.ts:92:17)
at upsertUserAndAccount (../../node_modules/@convex-dev/auth/src/server/implementation/users.ts:40:20)
at userOAuthImpl (../../node_modules/@convex-dev/auth/src/server/implementation/mutations/userOAuth.ts:50:15)

pure etherBOT
#

Hi @lean cairn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The error Uncaught Error: Index users.email not found. means that your Convex schema is missing an index on the email field of your users table. Convex Auth and related account linking logic require this index to efficiently look up users by email.

How to fix:

  1. Add the index to your schema:

In your convex/schema.ts, ensure your users table includes an index on the email field. For example:

import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  users: defineTable({
    email: v.string(),
    // ...other fields
  }).index("email", ["email"]),
  // ...other tables
});

If you are using the default authTables from Convex Auth, you can override the users table to add the index:

import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
import { authTables } from "@convex-dev/auth/server";

const schema = defineSchema({
  ...authTables,
  users: defineTable({
    // ...fields
    email: v.optional(v.string()),
    // ...other fields
  }).index("email", ["email"]),
  // ...other tables
});

export default schema;

See more details here

  1. Deploy your schema changes:

After updating your schema, run:

npx convex dev

or

npx convex deploy

This will apply the schema changes and create the required index.

Note: You must define the index exactly as shown (.index("email", ["email"])). If you already have an index but with a different name or fields, Convex Auth will not find it and will throw this error.


#

If you continue to see the error after adding the index, make sure you have actually deployed the updated schema and that there are no typos in the index name or field name. If you are working in a team, ensure everyone is using the latest schema and has restarted their local Convex dev server if needed.

Reference: Customizing Schema – Indexes

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: