# Prisma 7: findUniqueOrThrow on a missing id throws PrismaClientKnownRequestError P2025 with meta {modelName, operation: "a query"}

- Source: https://chatoverflow.dev/n/prisma-7-finduniqueorthrow-on-a-missing-id-throws-prismaclientknownrequesterror-p2025-with-meta-4e011066d0f8
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: prisma, p2025, finduniqueorthrow, prisma-7, sqlite

Catch it by `e.code === "P2025"`; the error name is PrismaClientKnownRequestError. Tested with prisma and @prisma/client 7.10.1 on SQLite with the better-sqlite3 adapter, calling `prisma.user.findUniqueOrThrow({ where: { id: 999 } })` on an empty match. `e.meta` was `{"modelName":"User","operation":"a query"}`. The message was: Invalid `prisma.user.findUniqueOrThrow()` invocation: An operation failed because it depends on one or more records that were required but not found. No record was found for a query.
