facebook/docusaurus · error · Error
${pluginIdLogPrefix}: no docs found in path=${docsDir}.
Error message
${pluginIdLogPrefix}: no docs found in path=${docsDir}. What it means
Thrown by the docs CLI version command when, for the default locale, the resolved docs directory does not exist or is empty. The plugin needs at least one source doc to cut a version. Non-default locales only emit a warning and are skipped, but the default locale is required.
Source
Thrown at packages/docusaurus-plugin-content-docs/src/cli.ts:109
i18n.path,
getLocaleConfig(i18n, locale).path,
);
// Copy docs files.
const docsDir =
locale === i18n.defaultLocale
? path.resolve(siteDir, docsPath)
: getDocsDirPathLocalized({
localizationDir,
pluginId,
versionName: CURRENT_VERSION_NAME,
});
if (
!(await fs.pathExists(docsDir)) ||
(await fs.readdir(docsDir)).length === 0
) {
if (locale === i18n.defaultLocale) {
throw new Error(
logger.interpolate`${pluginIdLogPrefix}: no docs found in path=${docsDir}.`,
);
} else {
logger.warn`${pluginIdLogPrefix}: no docs found in path=${docsDir}. Skipping.`;
return;
}
}
const newVersionDir =
locale === i18n.defaultLocale
? getVersionDocsDirPath(siteDir, pluginId, version)
: getDocsDirPathLocalized({
localizationDir,
pluginId,
versionName: version,
});
await fs.copy(docsDir, newVersionDir);
View on GitHub (pinned to 3f483e80e3)
Solutions
- Verify the docs plugin `path` option in docusaurus.config.js.
- Add at least one markdown file to the docs directory.
- Re-run the version command once docs exist.
Example fix
// before — docs.path points to a folder with no files // after — add blog/intro.md and confirm path matches the folder
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs-extra';
const exists = await fs.pathExists(docsDir);
const isEmpty = exists ? (await fs.readdir(docsDir)).length === 0 : true;
if (isEmpty) throw new Error(`No docs to version in ${docsDir}`); Prevention
- Confirm docsDir has files before running docs:version.
- Pin the docs plugin `path` option explicitly in config.
When it happens
Trigger: Running docs:version when docsDir (resolved from options.path or localized path) does not exist or contains no files. fs.pathExists is false or readdir length is 0.
Common situations: Configured docs `path` points to a non-existent or empty folder; you ran the version command before authoring any docs; or the docs were moved/deleted.
Related errors
- ${pluginIdLogPrefix}: this version already exists! Use a ver
- The docs folder does not exist for version "${versionName}".
- Docs version "${versionMetadata.versionName}" has no docs! A
- Invalid version name "${name}": version name ${message}.
- Unexpected error: file at "${filePath}" does not belong to a
AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12).
Data as JSON: /api/errors/972be5f6f4fbbfca.
Report an issue: GitHub.