facebook/docusaurus · error
Missing Docusaurus CLI command.
Error message
Missing Docusaurus CLI command.
What it means
Thrown by the CLI's catch-all action when Commander invokes the default action with no command argument — i.e. the user ran `docusaurus` (or `docusaurus --some-flag`) with no subcommand at all. cli.outputHelp() has already printed help before the throw.
Source
Thrown at packages/docusaurus/src/commands/cli.ts:290
)
.option(
'--migrate',
'migrate existing heading IDs to the target --syntax, if they are using a different syntax (default: false)',
)
.option(
'--overwrite',
'overwrite existing heading IDs, re-generate them from the heading text (default: false)',
)
.option(
'--maintain-case',
"keep the headings' casing, otherwise make all lowercase (default: false)",
)
.action(writeHeadingIds);
cli.arguments('<command>').action((cmd) => {
cli.outputHelp();
if (!cmd) {
throw new Error(logger.interpolate`Missing Docusaurus CLI command.`);
}
throw new Error(
logger.interpolate`Unknown Docusaurus CLI command code=${cmd}`,
);
});
// There is an unrecognized subcommand
// Let plugins extend the CLI before parsing
if (!isInternalCommand(command)) {
await externalCommand({cli, siteDir, config});
}
return cli;
}
View on GitHub (pinned to 3f483e80e3)
Solutions
- Provide a subcommand: `docusaurus build`, `docusaurus start`, etc.
- Check package.json scripts to ensure each Docusaurus invocation includes its subcommand.
- Run `docusaurus --help` to list available commands.
Example fix
// before (package.json)
"scripts": { "build": "docusaurus" }
// after
"scripts": { "build": "docusaurus build" } Defensive patterns
Strategy: validation
Validate before calling
const args = process.argv.slice(2);
if (args.length === 0 || args[0].startsWith('-')) {
console.error('Missing Docusaurus subcommand. See `docusaurus --help`.');
process.exit(1);
} Prevention
- Always pass an explicit subcommand in npm scripts.
- Document required subcommands in CI workflow files.
When it happens
Trigger: Executing `docusaurus` or `npx docusaurus` with no subcommand; only global flags supplied.
Common situations: Typing `docusaurus` to explore options, CI script that forgot the subcommand, or npm script misconfigured as `"build": "docusaurus"` instead of `"docusaurus build"`.
Related errors
- Unknown Docusaurus CLI command code=${cmd}
- Invalid package manager choice ${packageManager}. Must be on
- Directory already exists at path=${dest}!
- ${pluginIdLogPrefix}: this version already exists! Use a ver
- ${pluginIdLogPrefix}: no docs found in path=${docsDir}.
AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12).
Data as JSON: /api/errors/0c969969a1bef14f.
Report an issue: GitHub.