{"record":{"id":"2d4aa878ead23fe8","repo":"facebook/docusaurus","slug":"can-t-find-active-docs-plugin-for-pathname-pa","errorCode":null,"errorMessage":"Can't find active docs plugin for \"${pathname}\" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(allPluginData).map((plugin) => plugin.path).join(', ')}","messagePattern":"Can't find active docs plugin for \"(.+?)\" pathname, while it was expected to be found\\. Maybe you tried to use a docs feature that can only be used on a docs-related page\\? Existing docs plugin paths are: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/client/docsClientUtils.ts","lineNumber":47,"sourceCode":"): ActivePlugin | undefined {\n  const activeEntry = Object.entries(allPluginData)\n    // Route sorting: '/android/foo' should match '/android' instead of '/'\n    .sort((a, b) => b[1].path.localeCompare(a[1].path))\n    .find(\n      ([, pluginData]) =>\n        !!matchPath(pathname, {\n          path: pluginData.path,\n          exact: false,\n          strict: false,\n        }),\n    );\n\n  const activePlugin: ActivePlugin | undefined = activeEntry\n    ? {pluginId: activeEntry[0], pluginData: activeEntry[1]}\n    : undefined;\n\n  if (!activePlugin && options.failfast) {\n    throw new Error(\n      `Can't find active docs plugin for \"${pathname}\" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(\n        allPluginData,\n      )\n        .map((plugin) => plugin.path)\n        .join(', ')}`,\n    );\n  }\n\n  return activePlugin;\n}\n\nexport const getLatestVersion = (data: GlobalPluginData): GlobalVersion =>\n  data.versions.find((version) => version.isLast)!;\n\nexport function getActiveVersion(\n  data: GlobalPluginData,\n  pathname: string,\n): GlobalVersion | undefined {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/client/docsClientUtils.ts#L29-L65","documentation":"Thrown by getActivePlugin when no docs plugin instance's route path matches the current pathname, but options.failfast is true. This is a browser-side helper used by docs theme hooks; it lists all configured docs plugin paths so you can see what would have matched.","triggerScenarios":"Calling useActivePlugin({failfast: true}) (directly or via a hook relying on it) on a page whose pathname does not fall under any docs plugin's `routeBasePath`. matchPath returns no match across all plugin entries.","commonSituations":"Using a docs-related component/hook on a non-docs page (home, blog, custom page), or after changing the docs routeBasePath so previous links no longer match. Also when there are zero docs plugin instances enabled.","solutions":["Only call docs hooks on pages under a docs route base path.","Pass {failfast: false} and handle undefined, or branch on useActivePlugin() result.","Confirm the docs plugin is enabled and its routeBasePath covers the pathname."],"exampleFix":"// before\nconst active = useActivePlugin({ failfast: true });\n// after\nconst active = useActivePlugin({ failfast: false });\nif (!active) return null;","handlingStrategy":"type-guard","validationCode":"const active = getActivePlugin(allPluginData, pathname, {failfast: false});\nif (!active) return null; // not a docs page","typeGuard":"const isActivePlugin = (a: unknown): a is ActivePlugin =>\n  !!a && typeof a === 'object' && 'pluginId' in (a as object) && 'pluginData' in (a as object);","tryCatchPattern":null,"preventionTips":["Use {failfast: false} for hooks that may run on non-docs pages.","Branch rendering on whether an active plugin was found."],"tags":["docs","client","hooks","routing"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}