[GH-ISSUE #253] [BUG] Unhandled Prisma Error Causes Server Crash When Deleting a Non-Existent Notification #128

Closed
opened 2026-02-17 17:06:13 -05:00 by yindo · 1 comment
Owner

Originally created by @dustin2398 on GitHub (Sep 14, 2025).
Original GitHub issue: https://github.com/Drop-OSS/drop/issues/253

Describe the bug
The server crashes with an unhandled database error when a client tries to delete a notification that has already been deleted or no longer exists. This makes the entire server unreachable until it is manually restarted.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Drop client application.
  2. Perform an action that creates and then deletes a notification in quick succession, or have two clients interact with the same notification.
  3. This triggers an API call to the server to delete a notification record.
  4. See the server crash and become unresponsive. The container will have an "Exited" status.

Expected behavior
The server should handle the error gracefully. If a request is made to delete a notification that doesn't exist, the server should simply ignore it or return a 404 Not Found error without crashing the application.

Screenshots
N/A - This is a server-side crash. The relevant information is in the logs under "Additional context".

Desktop (please complete the following information):

  • Server OS: Ubuntu
  • Client OS: Windows
  • App Version: Server v0.3.3 | Client v0.3.3

Additional context
The following error is captured from the Docker container logs, which shows an unhandled PrismaClientKnownRequestError with code P2025.

[request error] [unhandled] [DELETE] http://[REDACTED]:3000/api/v1/notifications/adcb2309-2851-4c8d-8aa5-df6fa52d5346
 PrismaClientKnownRequestError: 
Invalid `prisma.notification.delete()` invocation:


An operation failed because it depends on one or more records that were required but not found. No record was found for a delete.
     at Jn.handleRequestError (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:7460)
     ... 5 lines matching cause stack trace ...
     at async Server.<anonymous> (file:///app/app/server/chunks/nitro/nitro.mjs:1:97992) {
   cause: PrismaClientKnownRequestError: 
   Invalid `prisma.notification.delete()` invocation:


   An operation failed because it depends on one or more records that were required but not found. No record was found for a delete.
       at Jn.handleRequestError (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:7460)
       at Jn.handleAndLogRequestError (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:6785)
       at Jn.request (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:6492)
       at async l (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:137:9767)
       at async Object.handler (file:///app/app/server/chunks/routes/api/v1/notifications/index.delete.mjs:1:1257)
       at async Object.handler (file:///app/app/server/chunks/nitro/nitro.mjs:1:95012)
       at async Server.<anonymous> (file:///app/app/server/chunks/nitro/nitro.mjs:1:97992) {
     code: 'P2025',
     meta: {
       modelName: 'Notification',
       cause: 'No record was found for a delete.'
     },
     clientVersion: '6.12.0'
   },
   statusCode: 500,
   fatal: false,
   unhandled: true,
   statusMessage: undefined,
   data: undefined
}
Originally created by @dustin2398 on GitHub (Sep 14, 2025). Original GitHub issue: https://github.com/Drop-OSS/drop/issues/253 **Describe the bug** The server crashes with an unhandled database error when a client tries to delete a notification that has already been deleted or no longer exists. This makes the entire server unreachable until it is manually restarted. **To Reproduce** Steps to reproduce the behavior: 1. Go to the Drop client application. 2. Perform an action that creates and then deletes a notification in quick succession, or have two clients interact with the same notification. 3. This triggers an API call to the server to delete a notification record. 4. See the server crash and become unresponsive. The container will have an "Exited" status. **Expected behavior** The server should handle the error gracefully. If a request is made to delete a notification that doesn't exist, the server should simply ignore it or return a `404 Not Found` error without crashing the application. **Screenshots** N/A - This is a server-side crash. The relevant information is in the logs under "Additional context". **Desktop (please complete the following information):** - **Server OS:** Ubuntu - **Client OS:** Windows - **App Version:** Server v0.3.3 | Client v0.3.3 **Additional context** The following error is captured from the Docker container logs, which shows an unhandled `PrismaClientKnownRequestError` with code `P2025`. ``` [request error] [unhandled] [DELETE] http://[REDACTED]:3000/api/v1/notifications/adcb2309-2851-4c8d-8aa5-df6fa52d5346 PrismaClientKnownRequestError: Invalid `prisma.notification.delete()` invocation: An operation failed because it depends on one or more records that were required but not found. No record was found for a delete. at Jn.handleRequestError (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:7460) ... 5 lines matching cause stack trace ... at async Server.<anonymous> (file:///app/app/server/chunks/nitro/nitro.mjs:1:97992) { cause: PrismaClientKnownRequestError: Invalid `prisma.notification.delete()` invocation: An operation failed because it depends on one or more records that were required but not found. No record was found for a delete. at Jn.handleRequestError (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:7460) at Jn.handleAndLogRequestError (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:6785) at Jn.request (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:128:6492) at async l (file:///app/app/server/node_modules/@prisma/client/runtime/library.mjs:137:9767) at async Object.handler (file:///app/app/server/chunks/routes/api/v1/notifications/index.delete.mjs:1:1257) at async Object.handler (file:///app/app/server/chunks/nitro/nitro.mjs:1:95012) at async Server.<anonymous> (file:///app/app/server/chunks/nitro/nitro.mjs:1:97992) { code: 'P2025', meta: { modelName: 'Notification', cause: 'No record was found for a delete.' }, clientVersion: '6.12.0' }, statusCode: 500, fatal: false, unhandled: true, statusMessage: undefined, data: undefined } ```
yindo added the bugconfirmedgood first issue labels 2026-02-17 17:06:13 -05:00
yindo closed this issue 2026-02-17 17:06:13 -05:00
Author
Owner

@DecDuck commented on GitHub (Sep 25, 2025):

For developer reference on how to fix this, the endpoint should use deleteMany and then check that a record has been deleted, rather than using the frankly awful delete function.

@DecDuck commented on GitHub (Sep 25, 2025): For developer reference on how to fix this, the endpoint should use `deleteMany` and then check that a record has been deleted, rather than using the frankly awful `delete` function.
yindo changed title from [BUG] Unhandled Prisma Error Causes Server Crash When Deleting a Non-Existent Notification to [GH-ISSUE #253] [BUG] Unhandled Prisma Error Causes Server Crash When Deleting a Non-Existent Notification 2026-06-05 14:21:36 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Drop-OSS/drop#128