overleaf/overleaf · error

Not Found (entity not found when downloading doc res.sendSta

Error message

Not Found (entity not found when downloading doc res.sendStatus(404))

What it means

Sent by getDoc when downloading a document and the error thrown while fetching project/doc metadata or the doc content from the document updater has name 'NotFoundError'. This is a sentinel-name guard: the project or doc id supplied in the URL does not exist (or is not visible), so the request is answered with 404 and a warning log.

Source

Thrown at services/web/app/src/Features/DocumentUpdater/DocumentUpdaterController.mjs:33

      type: 'doc',
    })

    const { lines } = await DocumentUpdaterHandler.promises.getDocument(
      projectId,
      docId,
      -1 // latest version only
    )

    res.setContentDisposition('attachment', { filename: doc.name })
    plainTextResponse(res, lines.join('\n'))
  } catch (err) {
    if (err.name === 'NotFoundError') {
      logger.warn(
        { err, projectId, docId },
        'entity not found when downloading doc'
      )

      return res.sendStatus(404)
    }

    logger.err(
      { err, projectId, docId },
      'error getting document for downloading'
    )

    return res.sendStatus(500)
  }
}

export default {
  getDoc: expressify(getDoc),
}

View on GitHub (pinned to 28ad3b03b7)

Solutions

  1. Verify the project_id and doc_id in the URL are correct and belong together
  2. Check that the doc has not been deleted or renamed in the project
  3. If the doc lives in a different project, use the correct project-scoped URL
  4. No server action needed if the client simply referenced a stale doc id
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at services/web/app/src/Features/DocumentUpdater/DocumentUpdaterController.mjs:33 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03). Data as JSON: /api/errors/1e024ad81ca202e4. Report an issue: GitHub.