{"record":{"id":"8d8a4ef070fdccd0","repo":"facebook/docusaurus","slug":"invalid-sidebars-file-the-document-with-id-doc","errorCode":null,"errorMessage":"Invalid sidebars file. The document with id \"${docId}\" was used in the sidebar, but no document with this id could be found.\nAvailable document ids are:\n- ${Object.keys(docsById).sort().join('\\n- ')}","messagePattern":"Invalid sidebars file\\. The document with id \"(.+?)\" was used in the sidebar, but no document with this id could be found\\.\nAvailable document ids are:\n- (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/props.ts","lineNumber":63,"sourceCode":"    href: permalink,\n    // Front Matter data takes precedence over sidebars.json\n    label: frontMatter.sidebar_label ?? item.label ?? title,\n    className: frontMatter.sidebar_class_name ?? item.className,\n    customProps: frontMatter.sidebar_custom_props ?? item.customProps,\n    docId: id,\n    unlisted,\n  };\n}\n\nexport function toSidebarsProp(\n  loadedVersion: Pick<LoadedVersion, 'docs' | 'sidebars'>,\n): PropSidebars {\n  const docsById = createDocsByIdIndex(loadedVersion.docs);\n\n  function getDocById(docId: string): DocMetadata {\n    const docMetadata = docsById[docId];\n    if (!docMetadata) {\n      throw new Error(\n        `Invalid sidebars file. The document with id \"${docId}\" was used in the sidebar, but no document with this id could be found.\nAvailable document ids are:\n- ${Object.keys(docsById).sort().join('\\n- ')}`,\n      );\n    }\n    return docMetadata;\n  }\n\n  const convertDocLink = (item: SidebarItemDoc): PropSidebarItemLink => {\n    const doc = getDocById(item.id);\n    return toSidebarDocItemLinkProp({item, doc});\n  };\n\n  function getCategoryLinkHref(\n    link: SidebarItemCategoryLink | undefined,\n  ): string | undefined {\n    switch (link?.type) {\n      case 'doc':","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/props.ts#L45-L81","documentation":"Thrown by toSidebarsProp > getDocById when a sidebar item references a doc id that is not present in the loaded version's docs index. The message lists all available ids (sorted) so you can pick the correct one or spot the typo.","triggerScenarios":"A sidebars configuration (sidebars.js or autogenerated sidebar) references an id that does not exist in versionMetadata docs. docsById[docId] is undefined during sidebar-to-prop conversion.","commonSituations":"Renaming/deleting a doc without updating sidebars.js, typo in an explicit doc id in the sidebar, or autogenerated sidebar referencing a doc whose id was changed via front matter.","solutions":["Open sidebars.js (or the autogenerated config) and find the id printed in the message.","Replace it with one of the available ids listed in the error.","If the doc was removed, remove the sidebar entry as well."],"exampleFix":"// before\nsidebars: { docs: [{ type: 'doc', id: 'introo' }] }\n// after\nsidebars: { docs: [{ type: 'doc', id: 'intro' }] }","handlingStrategy":"validation","validationCode":"const validIds = new Set(loadedVersion.docs.map(d => d.id));\nfunction checkSidebar(item: any) {\n  if (item?.type === 'doc' && !validIds.has(item.id)) {\n    throw new Error(`Sidebar references unknown doc id: ${item.id}`);\n  }\n  (item?.items ?? []).forEach(checkSidebar);\n}\nsidebars.forEach(checkSidebar);","typeGuard":"const isKnownDocId = (id: string, docsById: Record<string, unknown>): boolean =>\n  id in docsById;","tryCatchPattern":null,"preventionTips":["Keep sidebars.js in sync when renaming or deleting docs.","Add a CI step that validates sidebar doc ids against the docs index."],"tags":["docs","sidebar","config","validation"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}