{"record":{"id":"633a915e64b7ed72","repo":"overleaf/overleaf","slug":"internal-server-error-error-getting-document-res","errorCode":null,"errorMessage":"Internal Server Error (error getting document res.sendStatus(500))","messagePattern":"Internal Server Error \\(error getting document res\\.sendStatus\\(500\\)\\)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"services/web/app/src/Features/DocumentUpdater/DocumentUpdaterController.mjs","lineNumber":41,"sourceCode":"\n    res.setContentDisposition('attachment', { filename: doc.name })\n    plainTextResponse(res, lines.join('\\n'))\n  } catch (err) {\n    if (err.name === 'NotFoundError') {\n      logger.warn(\n        { err, projectId, docId },\n        'entity not found when downloading doc'\n      )\n\n      return res.sendStatus(404)\n    }\n\n    logger.err(\n      { err, projectId, docId },\n      'error getting document for downloading'\n    )\n\n    return res.sendStatus(500)\n  }\n}\n\nexport default {\n  getDoc: expressify(getDoc),\n}\n","sourceCodeStart":23,"sourceCodeEnd":48,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/app/src/Features/DocumentUpdater/DocumentUpdaterController.mjs#L23-L48","documentation":"Sent by getDoc when fetching the document from the document updater service fails with any error other than NotFoundError (e.g. document-updater unavailable, Redis issues, timeout). The error is logged as 'error getting document for downloading' and the client receives a bare 500.","triggerScenarios":"Thrown at services/web/app/src/Features/DocumentUpdater/DocumentUpdaterController.mjs:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check web logs for the underlying err to identify the document-updater failure","Verify the document-updater service and its Redis instance are healthy","Retry the download once the document-updater is responsive","If it persists, check for large docs hitting timeouts or memory limits"],"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"}