overleaf/overleaf · error · NotFoundError
No docs for project ${projectId}
Error message
No docs for project ${projectId} What it means
NotFoundError thrown by getAllNonDeletedDocs when getProjectsDocs returns null (not an empty array). null signals the project itself has no docs record/exists-no-docs condition rather than zero non-deleted docs, so it is treated as 'project not found'.
Source
Thrown at services/docstore/app/js/DocManager.js:150
})
if (!doc) throw new Errors.NotFoundError()
if (!Array.isArray(doc.lines)) throw new Errors.DocWithoutLinesError()
return doc.lines.join('\n')
},
async getAllDeletedDocs(projectId, filter) {
return await MongoManager.getProjectsDeletedDocs(projectId, filter)
},
async getAllNonDeletedDocs(projectId, filter) {
await DocArchive.unArchiveAllDocs(projectId)
const docs = await MongoManager.getProjectsDocs(
projectId,
{ include_deleted: false },
filter
)
if (docs == null) {
throw new Errors.NotFoundError(`No docs for project ${projectId}`)
}
if (filter.ranges) {
for (const doc of docs) {
RangeManager.fixCommentIds(doc)
}
}
return docs
},
async getAllDocVersions(projectId) {
// Do not unarchive all the docs: The version of archived docs is retained in mongo.
return await MongoManager.getProjectsDocs(
projectId,
{ include_deleted: false },
{ _id: true, version: true }
)
},
View on GitHub (pinned to 28ad3b03b7)
Solutions
- Catch NotFoundError and return an empty doc list if the project may legitimately have no docs
- Verify the projectId exists in the projects collection
- Confirm docs were flushed to docstore (web <-> docstore sync) before listing
- Correct the projectId at the call site
Example fix
// before
const docs = await docstore.getAllNonDeletedDocs(projectId) // throws
// after
let docs
try { docs = await docstore.getAllNonDeletedDocs(projectId) }
catch (e) {
if (e instanceof Errors.NotFoundError) docs = []
else throw e
} Defensive patterns
Strategy: try-catch
Validate before calling
// confirm project has any docs before listing non-deleted const all = await docstore.getAllDocs(projectId).catch(() => []) if (all.length === 0) return []
Type guard
function isProjectDocsNotFound(e) { return e && e.name === 'NotFoundError' && /No docs for project/.test(e.message) } Try / catch
try { return await getAllNonDeletedDocs(projectId) } catch (e) { if (isProjectDocsNotFound(e)) return []; throw e } Prevention
- Ensure web flushes new docs to docstore on project creation
- Treat null-vs-empty semantics explicitly upstream
- Validate projectId before calls
- Monitor for projects with zero docs as a sync-health signal
When it happens
Trigger: Calling getAllNonDeletedDocs for a projectId with no docs in mongo; project never had docs flushed; wrong projectId; project removed while docs collection emptied.
Common situations: Projects created but never written to docstore; fetching docs of a deleted project; id mix-ups between projects in a multi-tenant flow.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- project not found
- project not found
- project not found
- No such doc: ${docId} in project ${projectId}
- No such project/doc: ${projectId}/${docId}
AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03).
Data as JSON: /api/errors/3c5b9b988a0de788.
Report an issue: GitHub.