{"record":{"id":"9fb281d501f4c7e1","repo":"gastownhall/beads","slug":"error-command-not-found-s","errorCode":null,"errorMessage":"Error: command not found: %s","messagePattern":"Error: command not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/help_all.go","lineNumber":260,"sourceCode":"\t\tfmt.Fprintf(w, \"**Flags:**\\n\\n```\\n%s```\\n\\n\", localFlags.FlagUsages())\n\t}\n\n\t// Embedded doc supplement (raw Markdown, no MDX escaping).\n\tif sup, ok := commandDocSupplements[cmd.CommandPath()]; ok {\n\t\tfmt.Fprintf(w, \"%s\\n\\n\", strings.TrimSpace(sup))\n\t}\n}\n\n// writeSingleCommandDoc generates one command's documentation page as generic\n// Markdown: title/description frontmatter and portable CommonMark. bd never\n// emits site-generator-specific output (Docusaurus ids/slugs, Mintlify JSX,\n// navigation fragments) — repo post-processors adapt these pages to whatever\n// the documentation site needs.\nfunc writeSingleCommandDoc(w io.Writer, root *cobra.Command, cmdName string) error {\n\t// Find the command (handle nested commands like \"mol pour\")\n\tcmd := findCommand(root, cmdName)\n\tif cmd == nil {\n\t\treturn fmt.Errorf(\"Error: command not found: %s\", cmdName)\n\t}\n\n\tdocCommand := strings.TrimSpace(strings.TrimPrefix(commandPath(cmd), root.Name()))\n\tif docCommand == \"\" {\n\t\treturn errors.New(\"Error: cannot generate docs for root command\")\n\t}\n\n\tfmt.Fprintf(w, \"---\\n\")\n\tfmt.Fprintf(w, \"title: %q\\n\", \"bd \"+docCommand)\n\tif cmd.Short != \"\" {\n\t\tfmt.Fprintf(w, \"description: %q\\n\", cmd.Short)\n\t}\n\tfmt.Fprintf(w, \"---\\n\\n\")\n\tfmt.Fprintf(w, \"<!-- AUTO-GENERATED: do not edit manually -->\\n\\n\")\n\tfmt.Fprintf(w, \"Generated from `bd help --doc %s`.\\n\\n\", docCommand)\n\n\t// The frontmatter title serves as the page heading, so the top command\n\t// emits its body without a duplicate heading; subcommands start at ##.","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/help_all.go#L242-L278","documentation":"Returned by writeSingleCommandDoc when findCommand cannot locate cmdName under the root cobra command while generating per-command docs pages. It means the generic CLI doc generator was asked to document a command that does not exist.","triggerScenarios":"writeSingleCommandDoc is called (directly or via writeGenericCLIDocsDir/writeGeneratedCLIDocs, or tests) with a cmdName that findCommand(root, cmdName) cannot resolve, including nested names like 'mol pour' that are misspelled or removed.","commonSituations":"Docs pipeline lists a command that was renamed or deleted in a refactor, typo in the commands list, stale docs generation config referencing an old subcommand, or invoking the doc writer with a user-supplied command name.","solutions":["Fix the command name passed to the doc generator (check `bd --help` for the exact path, e.g. 'mol pour' not 'molpour').","Remove the stale entry from the docs command list if the command was deleted.","Regenerate docs after syncing to a version that contains the command."],"exampleFix":"// before: command removed in refactor\ncommands := []string{\"mol pour\", \"mol pour old-name\"}\n// after\ncommands := []string{\"mol pour\"}","handlingStrategy":"validation","validationCode":"// verify each command exists before generating docs\nfor _, name := range commands {\n\tif findCommand(root, name) == nil {\n\t\treturn fmt.Errorf(\"unknown command in docs list: %s\", name)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := writeSingleCommandDoc(&out, root, name); err != nil {\n\tif strings.HasPrefix(err.Error(), \"Error: command not found\") {\n\t\t// skip or fix the stale entry and continue\n\t}\n}","preventionTips":["Generate the docs command list from the cobra tree instead of hand-maintaining it.","Update the docs pipeline whenever commands are renamed or removed.","Add a CI test that generates docs for every registered command."],"tags":["cli","docs-generation","cobra","command-not-found"],"backgroundTag":"command-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}