Prisma P2025: An operation failed because it depends on one or more records that were required but not found

Prisma says P2025, records that were required but not found? The operation depends on a record that does not exist. The message gives the cause.

Reviewed October 24, 2026

What it means in plain English

Prisma ORM v7's error reference defines P2025 as: An operation failed because it depends on one or more records that were required but not found. {cause}

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

Nearby codes mean different things. P2002 is a unique constraint failure. P2003 is a foreign key constraint failure on {field_name}. P2021 is a table that does not exist in the current database.

Likely causes

  • The query depends on a record that is not in the database. {cause} in the message says more.
  • The record was deleted, or the ID or filter the app passes does not match a record.
  • The failure is a foreign key, a unique constraint, or a missing table. Those are P2003, P2002, and P2021 on the same page.

How to fix it, step by step

  1. Read code. Stay on this page when it is P2025.
  2. Read {cause} in the message, and read meta for the extra detail.
  3. Check the ID or filter the failing call passes, and whether a matching record exists in the database the app is connected to.
  4. The reference defines P2025 and does not add a procedure. Fix the input or create the required record so the operation has the record it depends on.
  5. If the code is P2021, see Prisma P2021. If it is P2002, see Prisma P2002.

How to check it worked

  • The same operation no longer throws P2025.
  • code on the next error, if there is one, is not P2025.

Sources

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