{"record":{"id":"3dd09db266d1cb6b","repo":"facebook/docusaurus","slug":"unknown-docusaurus-cli-command-code-cmd","errorCode":null,"errorMessage":"Unknown Docusaurus CLI command code=${cmd}","messagePattern":"Unknown Docusaurus CLI command code=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/commands/cli.ts","lineNumber":292,"sourceCode":"      '--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":274,"sourceCodeEnd":305,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/commands/cli.ts#L274-L305","documentation":"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.","triggerScenarios":"Typing a non-existent command such as `docusaurus biuld` (typo) or `docusaurus deploy-staging` when no plugin registers that command.","commonSituations":"Typos, removed/renamed commands after a Docusaurus upgrade (e.g. old `docusaurus publish`), or expecting a plugin command that was never registered.","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."],"exampleFix":"// before\ndocusaurus biuld\n// after\ndocusaurus build","handlingStrategy":"validation","validationCode":"import {readFileSync} from 'fs';\n// before invoking, validate the command is one Docusaurus knows\nconst known = ['build','start','serve','deploy','clear','write-translations','write-heading-ids','docs','init'];\nif (!known.includes(cmd)) throw new Error(`Unknown command: ${cmd}`);","typeGuard":"function isKnownCommand(cmd: string): boolean {\n  return ['build','start','serve','deploy','clear','write-translations','write-heading-ids','docs','init'].includes(cmd);\n}","tryCatchPattern":null,"preventionTips":["Double-check subcommand spelling.","After upgrades, review the changelog for renamed/removed commands.","Ensure any plugin-provided command is enabled in config."],"tags":["cli","commander","usage"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}