{"record":{"id":"0c969969a1bef14f","repo":"facebook/docusaurus","slug":"missing-docusaurus-cli-command","errorCode":null,"errorMessage":"Missing Docusaurus CLI command.","messagePattern":"Missing Docusaurus CLI command\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/commands/cli.ts","lineNumber":290,"sourceCode":"    )\n    .option(\n      '--migrate',\n      'migrate existing heading IDs to the target --syntax, if they are using a different syntax (default: false)',\n    )\n    .option(\n      '--overwrite',\n      'overwrite existing heading IDs, re-generate them from the heading text (default: false)',\n    )\n    .option(\n      '--maintain-case',\n      \"keep the headings' casing, otherwise make all lowercase (default: false)\",\n    )\n    .action(writeHeadingIds);\n\n  cli.arguments('<command>').action((cmd) => {\n    cli.outputHelp();\n    if (!cmd) {\n      throw new Error(logger.interpolate`Missing Docusaurus CLI command.`);\n    }\n    throw new Error(\n      logger.interpolate`Unknown Docusaurus CLI command code=${cmd}`,\n    );\n  });\n\n  // There is an unrecognized subcommand\n  // Let plugins extend the CLI before parsing\n  if (!isInternalCommand(command)) {\n    await externalCommand({cli, siteDir, config});\n  }\n\n  return cli;\n}\n","sourceCodeStart":272,"sourceCodeEnd":305,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/commands/cli.ts#L272-L305","documentation":"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.","triggerScenarios":"Executing `docusaurus` or `npx docusaurus` with no subcommand; only global flags supplied.","commonSituations":"Typing `docusaurus` to explore options, CI script that forgot the subcommand, or npm script misconfigured as `\"build\": \"docusaurus\"` instead of `\"docusaurus build\"`.","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."],"exampleFix":"// before (package.json)\n\"scripts\": { \"build\": \"docusaurus\" }\n// after\n\"scripts\": { \"build\": \"docusaurus build\" }","handlingStrategy":"validation","validationCode":"const args = process.argv.slice(2);\nif (args.length === 0 || args[0].startsWith('-')) {\n  console.error('Missing Docusaurus subcommand. See `docusaurus --help`.');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit subcommand in npm scripts.","Document required subcommands in CI workflow files."],"tags":["cli","commander","usage"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}