facebook/docusaurus · error · Error

Can't find active docs plugin for "${pathname}" pathname, wh

Error message

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(', ')}

What it means

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.

Source

Thrown at packages/docusaurus-plugin-content-docs/src/client/docsClientUtils.ts:47

): ActivePlugin | undefined {
  const activeEntry = Object.entries(allPluginData)
    // Route sorting: '/android/foo' should match '/android' instead of '/'
    .sort((a, b) => b[1].path.localeCompare(a[1].path))
    .find(
      ([, pluginData]) =>
        !!matchPath(pathname, {
          path: pluginData.path,
          exact: false,
          strict: false,
        }),
    );

  const activePlugin: ActivePlugin | undefined = activeEntry
    ? {pluginId: activeEntry[0], pluginData: activeEntry[1]}
    : undefined;

  if (!activePlugin && options.failfast) {
    throw new Error(
      `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(', ')}`,
    );
  }

  return activePlugin;
}

export const getLatestVersion = (data: GlobalPluginData): GlobalVersion =>
  data.versions.find((version) => version.isLast)!;

export function getActiveVersion(
  data: GlobalPluginData,
  pathname: string,
): GlobalVersion | undefined {

View on GitHub (pinned to 3f483e80e3)

Solutions

  1. Only call docs hooks on pages under a docs route base path.
  2. Pass {failfast: false} and handle undefined, or branch on useActivePlugin() result.
  3. Confirm the docs plugin is enabled and its routeBasePath covers the pathname.

Example fix

// before
const active = useActivePlugin({ failfast: true });
// after
const active = useActivePlugin({ failfast: false });
if (!active) return null;
Defensive patterns

Strategy: type-guard

Validate before calling

const active = getActivePlugin(allPluginData, pathname, {failfast: false});
if (!active) return null; // not a docs page

Type guard

const isActivePlugin = (a: unknown): a is ActivePlugin =>
  !!a && typeof a === 'object' && 'pluginId' in (a as object) && 'pluginData' in (a as object);

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12). Data as JSON: /api/errors/2d4aa878ead23fe8. Report an issue: GitHub.