facebook/docusaurus · error
Unknown Docusaurus CLI command code=${cmd}
Error message
Unknown Docusaurus CLI command code=${cmd} What it means
Thrown by the same CLI default action when a command argument IS supplied but does not match any registered internal subcommand (and no external/plugin command picks it up). The interpolation token `code=${cmd}` renders the unknown command name verbatim.
Source
Thrown at packages/docusaurus/src/commands/cli.ts:292
'--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
- Check spelling against `docusaurus --help`.
- After an upgrade, consult the changelog for renamed/removed commands.
- If the command should come from a plugin, ensure that plugin is enabled in docusaurus.config.js.
Example fix
// before docusaurus biuld // after docusaurus build
Defensive patterns
Strategy: validation
Validate before calling
import {readFileSync} from 'fs';
// before invoking, validate the command is one Docusaurus knows
const known = ['build','start','serve','deploy','clear','write-translations','write-heading-ids','docs','init'];
if (!known.includes(cmd)) throw new Error(`Unknown command: ${cmd}`); Type guard
function isKnownCommand(cmd: string): boolean {
return ['build','start','serve','deploy','clear','write-translations','write-heading-ids','docs','init'].includes(cmd);
} Prevention
- Double-check subcommand spelling.
- After upgrades, review the changelog for renamed/removed commands.
- Ensure any plugin-provided command is enabled in config.
When it happens
Trigger: Typing a non-existent command such as `docusaurus biuld` (typo) or `docusaurus deploy-staging` when no plugin registers that command.
Common situations: Typos, removed/renamed commands after a Docusaurus upgrade (e.g. old `docusaurus publish`), or expecting a plugin command that was never registered.
Related errors
- Missing Docusaurus CLI command.
- 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/3dd09db266d1cb6b.
Report an issue: GitHub.