Prisma · query error · P2025
P2025: Record required but not found
PrismaClientKnownRequestError:
Invalid `db.user.update()` invocation:
An operation failed because it depends on one or more records that were required but not found. No record was found for an update.What it means
update, delete, connect or a findUniqueOrThrow / findFirstOrThrow call needed a row that wasn't there.
Common causes
- Updating by an id or email that doesn't exist (or belongs to another user's filter)
- Deleting something that was already deleted, often a double-clicked button or a retried webhook
- connect: { id } pointing at a missing related record
How to fix it
- If missing is normal, use updateMany / deleteMany (they return a count instead of throwing) or findUnique and check for null
- Otherwise catch code P2025 and return a 404
- Check the where clause uses a field that's really unique for this user
Prompt for Cursor or Claude Code
Prisma throws P2025 record not found. Find the update, delete, connect or *OrThrow call, and decide whether a missing record is expected. If it is, switch to findUnique + null check or updateMany/deleteMany; if not, catch P2025 and return a 404. Show me the diff.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Prisma error fixer.
next: skip the next one
Skip the setup. The VibeBoot SaaS Starter ships a ready prisma/schema.prisma and one Prisma client in src/lib/db.ts (SQLite by default, Postgres by changing the provider), plus auth and Stripe on Next.js 16.4.3. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Prisma errors
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.