{"record":{"id":"468440cd2fb74412","repo":"facebook/docusaurus","slug":"unable-to-get-broken-links-for-page-pagepath","errorCode":null,"errorMessage":"Unable to get broken links for page ${pagePath}.","messagePattern":"Unable to get broken links for page (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/server/brokenLinks.ts","lineNumber":223,"sourceCode":"  collectedLinks: CollectedLinksNormalized;\n  routes: RouteConfig[];\n}): BrokenLinksMap {\n  const filteredRoutes = filterIntermediateRoutes(routes);\n\n  const helper = createBrokenLinksHelper({\n    collectedLinks,\n    routes: filteredRoutes,\n  });\n\n  const result: BrokenLinksMap = {};\n  collectedLinks.forEach((_unused, pagePath) => {\n    try {\n      result[pagePath] = getBrokenLinksForPage({\n        pagePath,\n        helper,\n      });\n    } catch (e) {\n      throw new Error(`Unable to get broken links for page ${pagePath}.`, {\n        cause: e,\n      });\n    }\n  });\n  return result;\n}\n\nfunction brokenLinkMessage(brokenLink: BrokenLink): string {\n  const showResolvedLink = brokenLink.link !== brokenLink.resolvedLink;\n  return `${brokenLink.link}${\n    showResolvedLink ? ` (resolved as: ${brokenLink.resolvedLink})` : ''\n  }`;\n}\n\nfunction createBrokenLinksMessage(\n  pagePath: string,\n  brokenLinks: BrokenLink[],\n): string {","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/server/brokenLinks.ts#L205-L241","documentation":"Thrown by `getBrokenLinks` while iterating collected links for each page; the inner `getBrokenLinksForPage` threw (the original error is attached as `cause`). This is a defensive wrapper — broken-link detection itself hit an unexpected internal error computing the link set for one specific page.","triggerScenarios":"Calling the broken-links collector (e.g. during `docusaurus build` with `onBrokenLinks` not set to `ignore`) where `getBrokenLinksForPage` throws — typically because the route/link helper encountered malformed route metadata, a missing anchor target, or an unexpected URL shape for the given `pagePath`.","commonSituations":"A plugin emits a route with metadata the helper cannot resolve; a page links to an anchor on a page that no longer exists in the route map; upgrading Docusaurus or a plugin exposes a previously-tolerated inconsistency; custom plugin returning unusual `permalink`/`source` values.","solutions":["Inspect `error.cause` for the real underlying failure — fixing that resolves this wrapper error.","Temporarily set `onBrokenLinks: 'ignore'` (or `warn`) in config to confirm the build proceeds and isolate the offending page.","Audit the route config of the failing `pagePath` (check the plugin that owns it) for malformed path/permalink metadata.","Report a Docusaurus bug with `pagePath` and the `cause` stack if the route config is valid."],"exampleFix":"// before (docusaurus.config.js)\nexport default { onBrokenLinks: 'throw' }; // build aborts\n// isolate first\nexport default { onBrokenLinks: 'warn' }; // see warnings, then fix the cause","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  result[pagePath] = getBrokenLinksForPage({pagePath, helper});\n} catch (e) {\n  throw new Error(`Unable to get broken links for page ${pagePath}.`, {cause: e});\n}","preventionTips":["Always inspect `error.cause` — the real failure is there.","Set `onBrokenLinks: 'warn'` while debugging to surface all pages.","Keep route metadata consistent across plugins to avoid helper confusion."],"tags":["broken-links","build","routing","internal"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}