BoundaryML/baml · error

usage: baml toolchain uninstall

Error message

usage: baml toolchain uninstall <version>

What it means

Usage guard in the baml wrapper's toolchain dispatch: `baml toolchain uninstall` was invoked without a version argument. The uninstall subcommand expects exactly one operand (the toolchain version to remove) and the argument parser rejects anything with fewer or more before attempting removal.

Solutions

  1. Pass a version: `baml toolchain uninstall <version>` (e.g. `baml toolchain uninstall 0.210.0`).
  2. Run `baml toolchain list` to see exact version strings that can be uninstalled.
  3. Uninstall the active toolchain only if you have another one to switch to.

Example fix

# before
baml toolchain uninstall

# after
baml toolchain uninstall 0.210.0
Defensive patterns

Strategy: validation

Validate before calling

version="${VERSION:?usage: baml toolchain uninstall <version>}"
installed=$(baml toolchain list | grep -F "$version") || { echo "version not installed" >&2; exit 1; }
baml toolchain uninstall "$version"

Type guard

const hasVersionArg = (args: string[]): args is [string, string] =>
  args.length >= 2 && args[1].length > 0;

Try / catch

try:
    subprocess.run(["baml", "toolchain", "uninstall", version], check=True)
except subprocess.CalledProcessError as e:
    if "usage: baml toolchain uninstall" in e.stderr.decode():
        raise SystemExit("Uninstall requires an explicit <version> argument")

Prevention

When it happens

Trigger: Running `baml toolchain uninstall` with no version argument.

Common situations: Users assuming uninstall prompts for or removes all toolchains, scripts with empty version variables, or forgetting the exact installed version string.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/f7218b332216ec21. Report an issue: GitHub.

Appendix: source

Thrown at baml_language/crates/baml/src/main.rs:389

            })?;
            if args.len() > 2 {
                return Err(anyhow!(
                    "usage: baml toolchain pin <canary|nightly|version|path>\nunexpected arguments: {}",
                    args[2..].join(" ")
                ));
            }
            pin_toolchain(selector, manifest_base_url.as_deref())
        }
        Some("update") => update_toolchain(manifest_base_url.as_deref()),
        Some("status") => status_toolchain(manifest_base_url.as_deref()),
        Some("list") => {
            list_toolchains();
            Ok(())
        }
        Some("uninstall") => {
            let version = args
                .get(1)
                .ok_or_else(|| anyhow!("usage: baml toolchain uninstall <version>"))?;
            uninstall_toolchain(version)
        }
        Some(other) => Err(anyhow!(
            "unknown toolchain command {other:?}\n\n{TOOLCHAIN_HELP}"
        )),
    }
}

fn is_help_arg(arg: &str) -> bool {
    matches!(arg, "--help" | "-h" | "help")
}

fn parse_manifest_base_url(mut args: Vec<String>) -> Result<(Vec<String>, Option<String>)> {
    let mut manifest_base_url = None;
    let mut i = 0;
    while i < args.len() {
        if args[i] == "--manifest-base-url" {
            let value = args

View on GitHub (pinned to bd85ce9dee)