{"record":{"id":"3ee3c4bad034c437","repo":"BoundaryML/baml","slug":"no-command-for-prefix-available-commands","errorCode":null,"errorMessage":"no command `{}` for `{prefix}`. Available commands:\n    {}","messagePattern":"no command `(.+?)` for `(.+?)`\\. Available commands:\n    (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/help_command.rs","lineNumber":75,"sourceCode":"\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() {\n            command = command.after_long_help(\"\");\n        }\n        promote_examples(&mut command);\n        if command.has_subcommands() {\n            let hint = format!(","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/help_command.rs#L57-L93","documentation":"Same custom help renderer as the sibling error, but for the common case: the nearest known command does have subcommands, so the error lists all available choices after the message. It fires whenever the unmatched portion of the command line cannot be matched to a subcommand.","triggerScenarios":"Typing an unknown or misspelled subcommand under a command that has subcommands, e.g. `baml generte` or `baml toolchain instal`; render_from collects visible subcommand names and raises this error with the list.","commonSituations":"Typos, outdated muscle memory after a CLI rename, or scripts referencing removed subcommands.","solutions":["Pick the correct command from the 'Available commands' list in the message","Run `baml <prefix> --help` for full option details","Update scripts/aliases that reference old subcommand names"],"exampleFix":"// before\n$ baml toolchain instal canary\n// after\n$ baml toolchain install canary","handlingStrategy":"validation","validationCode":"// verify the subcommand name before invoking\n$ baml toolchain --help   # list exact subcommand names","typeGuard":null,"tryCatchPattern":"if !ok {\n    let msg = stderr;\n    if let Some(list) = msg.split(\"Available commands:\\n\").nth(1) {\n        eprintln!(\"Unknown subcommand. Did you mean one of: {list}?\");\n    }\n}","preventionTips":["Enable shell completion for baml to avoid typos","Re-generate completion caches after upgrading the CLI","Grep CI scripts for subcommand names after every BAML upgrade"],"tags":["cli","help","typo"],"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-14T05:17:10.506Z"}