{"record":{"id":"9e1852762df69dc5","repo":"overleaf/overleaf","slug":"mongo-health-check-failed-error-present","errorCode":null,"errorMessage":"mongo health check failed, error present","messagePattern":"mongo health check failed, error present","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"services/web/app/src/Features/HealthCheck/HealthCheckController.mjs","lineNumber":69,"sourceCode":"  },\n\n  checkRedis(req, res, next) {\n    return rclient.healthCheck(function (error) {\n      if (error != null) {\n        logger.err({ err: error }, 'failed redis health check')\n        return res.sendStatus(500)\n      } else {\n        return res.sendStatus(200)\n      }\n    })\n  },\n\n  checkMongo(req, res, next) {\n    return UserGetter.getUserEmail(\n      settings.smokeTest.userId,\n      function (err, email) {\n        if (err != null) {\n          logger.err({ err }, 'mongo health check failed, error present')\n          return res.sendStatus(500)\n        } else if (email == null) {\n          logger.err(\n            { err },\n            'mongo health check failed, no emai present in find result'\n          )\n          return res.sendStatus(500)\n        } else {\n          return res.sendStatus(200)\n        }\n      }\n    )\n  },\n}\n","sourceCodeStart":51,"sourceCodeEnd":84,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/app/src/Features/HealthCheck/HealthCheckController.mjs#L51-L84","documentation":"Dedicated Mongo health endpoint: the callback-style getUserEmail query returned a non-null err, so the Mongo driver itself failed (connection, timeout, or query error). Unlike the 'no email' variant, this indicates a transport/query-level failure rather than missing data.","triggerScenarios":"Thrown at services/web/app/src/Features/HealthCheck/HealthCheckController.mjs:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check Mongo connection strings and replica set health","Look at the logged err for the specific driver error (e.g. MongoNetworkError, MongoTimeoutError)","Scale or tune connection pool sizes if the health check times out under load"],"exampleFix":null,"handlingStrategy":"try-catch","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"}