Prisma P2021: The table {table} does not exist in the current database

Prisma says P2021 The table does not exist in the current database? The database the app connects to has no table by that name.

Reviewed October 24, 2026

What it means in plain English

Prisma ORM v7's error reference defines P2021 as: The table {table} does not exist in the current database.

Prisma Client throws PrismaClientKnownRequestError when the query engine returns a known error related to the request. That error has code, meta, message, and clientVersion.

P2022 is the same kind of error for a column: The column {column} does not exist in the current database. P1001 is different: Prisma cannot reach the database server at all.

Likely causes

  • The database the app connects to does not have the table named in the message.
  • Migrations that create the table were not applied to that database. Prisma's CLI reference says migrate deploy applies all pending migrations and is primarily used in non-development environments.
  • The error is P2022 (a missing column) or P1001 (no connection), not a missing table.

How to fix it, step by step

  1. Read code. Stay on this page when it is P2021. Read {table} in the message to see which table is missing.
  2. Confirm which database the app is connected to in the environment that failed.
  3. If the table comes from a Prisma migration, apply pending migrations to that database. Prisma's CLI reference says migrate deploy applies all pending migrations and creates the database if it does not exist. It does not look for drift, does not reset the database, and does not generate artifacts.
npx prisma migrate deploy
  1. migrate deploy is not supported on MongoDB. Prisma's CLI reference says to use db push there instead.
  2. If the code is P2022, the missing object is a column, not a table. If it is P1001, see Prisma can't reach database server.

How to check it worked

  • The same query no longer throws P2021.
  • npx prisma migrate deploy reports no pending migrations for that database.

Sources

More Database connections fixes

Keep going on your own.

The guides stay free. A deep leak report is $15. Fix packs are $24, or $49 for all three. There is no done-for-you repair.

See products