{"record":{"id":"bbcf53387168aa20","repo":"BoundaryML/baml","slug":"no-command-for-prefix-prefix-has-no-subcommands","errorCode":null,"errorMessage":"no command `{}` for `{prefix}`; `{prefix}` has no subcommands","messagePattern":"no command `(.+?)` for `(.+?)`; `(.+?)` has no subcommands","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/help_command.rs","lineNumber":70,"sourceCode":"    render_from(query, RuntimeCli::command())\n}\n\nfn render_from(query: &[String], mut root: clap::Command) -> Result<RenderedHelp> {\n    root.build();\n\n    let command = find_command(query, &root).map_err(|(unmatched, nearest)| {\n        let prefix = if query.len() == unmatched.len() {\n            \"baml\".to_string()\n        } else {\n            format!(\"baml {}\", query[..query.len() - unmatched.len()].join(\" \"))\n        };\n        let choices = nearest\n            .get_subcommands()\n            .filter(|command| !command.is_hide_set() && command.get_name() != \"help\")\n            .map(clap::Command::get_name)\n            .collect::<Vec<_>>();\n        if choices.is_empty() {\n            anyhow!(\n                \"no command `{}` for `{prefix}`; `{prefix}` has no subcommands\",\n                unmatched.join(\" \")\n            )\n        } else {\n            anyhow!(\n                \"no command `{}` for `{prefix}`. Available commands:\\n    {}\",\n                unmatched.join(\" \"),\n                choices.join(\"\\n    \")\n            )\n        }\n    })?;\n\n    let is_root = query.is_empty();\n    let mut command = command.clone();\n    let help = if is_root {\n        command.render_help()\n    } else {\n        if command.get_after_long_help().is_none() {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/help_command.rs#L52-L88","documentation":"The custom help renderer in help_command.rs builds suggestions for an unmatched subcommand path. When the nearest known command has no visible subcommands at all (after hiding hidden commands and `help`), it throws this variant saying `{prefix}` has no subcommands. It indicates the user typed a subcommand under a leaf command.","triggerScenarios":"Invoking e.g. `baml generate some-sub` or `baml toolchain foo` where the parent command accepts no subcommands; render_from finds the nearest matching command but its get_subcommands() list is empty.","commonSituations":"Typos that leave only the root-level command matched, or assuming a leaf command (like `baml version`) has subcommands.","solutions":["Remove the extra subcommand token and run the leaf command alone","Run `baml help` or `baml <prefix> --help` to see valid usage","Check spelling of the intended subcommand against `baml help` output"],"exampleFix":"// before\n$ baml version list\n// after\n$ baml version","handlingStrategy":"validation","validationCode":"// check the command exists before running\n$ baml <prefix> --help   # confirm the parent command accepts subcommands","typeGuard":null,"tryCatchPattern":"match exit_status {\n    Err/failure where stderr.contains(\"has no subcommands\") => eprintln!(\"This command is a leaf; drop the extra subcommand.\"),\n    other => other,\n}","preventionTips":["Consult `baml help` before composing multi-level commands","Treat leaf commands (e.g. version) as terminal — no subcommands","Shell-complete with the actual baml binary, not cached lists"],"tags":["cli","help","argument-error"],"backgroundTag":"command-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}