{"record":{"id":"90ef87d063db4aff","repo":"overleaf/overleaf","slug":"not-found-catch-all-route-res-sendstatus-404","errorCode":null,"errorMessage":"Not Found (catch-all route res.sendStatus(404))","messagePattern":"Not Found \\(catch-all route res\\.sendStatus\\(404\\)\\)","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"services/notifications/app.ts","lineNumber":50,"sourceCode":"app.post('/user/:user_id', NotificationsController.addNotification)\napp.get('/user/:user_id', NotificationsController.getUserNotifications)\napp.delete(\n  '/user/:user_id/notification/:notification_id',\n  NotificationsController.removeNotificationId\n)\napp.delete('/user/:user_id', NotificationsController.removeNotificationKey)\napp.delete('/key/:key', NotificationsController.removeNotificationByKeyOnly)\napp.get('/key/:key/count', NotificationsController.countNotificationsByKeyOnly)\napp.delete(\n  '/key/:key/bulk',\n  NotificationsController.deleteUnreadNotificationsByKeyOnlyBulk\n)\n\napp.get('/status', (req, res) => res.send('notifications is up'))\n\napp.get('/health_check', HealthCheckController.check)\n\napp.get('*', (req, res) => res.sendStatus(404))\n\nconst handleApiError: ErrorRequestHandler = (\n  err: Error,\n  req: Request,\n  res: Response,\n  next: NextFunction\n) => {\n  req.logger.addFields({ err })\n  if (err instanceof InvalidParamsError) {\n    req.logger.setLevel('warn')\n    res.sendStatus(404)\n  } else if (err instanceof InvalidRequestError) {\n    req.logger.setLevel('warn')\n    res.sendStatus(400)\n  } else {\n    req.logger.setLevel('error')\n    res.sendStatus(500)\n  }","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/notifications/app.ts#L32-L68","documentation":"Catch-all GET route in the notifications service: any request path not matching the defined notification routes is answered with a bare 404 before reaching any controller.","triggerScenarios":"Thrown at services/notifications/app.ts:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the request path against the documented notifications API routes","Correct typos or outdated route prefixes in the client call"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}