{"record":{"id":"c8171240345f884c","repo":"facebook/docusaurus","slug":"error-when-loading-doc-id-in-doc-sourcedirnam","errorCode":null,"errorMessage":"Error when loading ${doc.id} in ${doc.sourceDirName}: the pagination_${type} front matter points to a non-existent ID ${docId}.","messagePattern":"Error when loading (.+?) in (.+?): the pagination_(.+?) front matter points to a non-existent ID (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/docs.ts","lineNumber":298,"sourceCode":"  // Add sidebar/next/previous to the docs\n  function addNavData(doc: DocMetadataBase): DocMetadata {\n    const navigation = sidebarsUtils.getDocNavigation({\n      docId: doc.id,\n      displayedSidebar: doc.frontMatter.displayed_sidebar,\n      unlistedIds,\n    });\n\n    const toNavigationLinkByDocId = (\n      docId: string | null | undefined,\n      type: 'prev' | 'next',\n    ): PropNavigationLink | undefined => {\n      if (!docId) {\n        return undefined;\n      }\n      const navDoc = docsById[docId];\n      if (!navDoc) {\n        // This could only happen if user provided the ID through front matter\n        throw new Error(\n          `Error when loading ${doc.id} in ${doc.sourceDirName}: the pagination_${type} front matter points to a non-existent ID ${docId}.`,\n        );\n      }\n      // Gracefully handle explicitly providing an unlisted doc ID in production\n      if (navDoc.unlisted) {\n        return undefined;\n      }\n      return toDocNavigationLink(navDoc);\n    };\n\n    const previous =\n      doc.frontMatter.pagination_prev !== undefined\n        ? toNavigationLinkByDocId(doc.frontMatter.pagination_prev, 'prev')\n        : toNavigationLink(navigation.previous, docsById);\n    const next =\n      doc.frontMatter.pagination_next !== undefined\n        ? toNavigationLinkByDocId(doc.frontMatter.pagination_next, 'next')\n        : toNavigationLink(navigation.next, docsById);","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/docs.ts#L280-L316","documentation":"Thrown by addDocNavigation when a doc's `pagination_prev` or `pagination_next` front matter points to an id that does not exist in the version's docs index. Only user-supplied ids can trigger this, because generated pagination always uses existing docs.","triggerScenarios":"Front matter sets pagination_prev/pagination_next to a doc id that was renamed, deleted, or never existed. docsById[docId] is undefined when resolving the navigation link.","commonSituations":"Renaming a doc id without updating pagination refs in neighbours, deleting a doc that others point to, or typos in the referenced id.","solutions":["Open the doc file and source dir printed in the message.","Update pagination_prev/pagination_next to a valid id, or remove the field.","Search the version's docs for the intended target id to confirm spelling."],"exampleFix":"---\n# before\npagination_next: instalation\n---\n---\n# after\npagination_next: installation\n---","handlingStrategy":"validation","validationCode":"const validIds = new Set(docs.map(d => d.id));\nfor (const ref of ['pagination_prev','pagination_next']) {\n  const v = frontMatter[ref];\n  if (v && !validIds.has(v)) throw new Error(`${ref}='${v}' is not a known doc id`);\n}","typeGuard":"const isValidDocRef = (id: string, docsById: Record<string, unknown>): id is string =>\n  typeof id === 'string' && id in docsById;","tryCatchPattern":null,"preventionTips":["When renaming/deleting a doc, search for pagination_prev/next references.","Lint pagination front matter against the version's id index."],"tags":["docs","frontmatter","pagination","navigation"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}