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, andP2021on the same page.
How to fix it, step by step
- Read
code. Stay on this page when it isP2025. - Read
{cause}in the message, and readmetafor the extra detail. - Check the ID or filter the failing call passes, and whether a matching record exists in the database the app is connected to.
- 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.
- If the code is
P2021, see Prisma P2021. If it isP2002, see Prisma P2002.
How to check it worked
- The same operation no longer throws
P2025. codeon the next error, if there is one, is notP2025.
Sources
Related 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.